Jump to content

LimpLungs

Members
  • Posts

    11
  • Joined

  • Last visited

Everything posted by LimpLungs

  1. Oh wow, I feel like an idiot now. Yes, the problem was both the not running the code in (!worldObj.isRemote) like my other two tile entities, and I completely forgot the compound.setTag("Items", items); As for the this.entry, I have it being declared as -1 to start, and then whenever an itemstack enters the block, it changes it to the side it entered from. Basically, I'm making a transport block similar to pipes and it needs to lock behind it when it goes through so it doesn't head backwards. It all is working now thank you so much for proofreading that!
  2. So here is the section that is giving me problems: http://pastebin.com/LGj2xqBV Basically, it prints the correct integer for entry in the update entity, but when I go to write it, it prints incorrect. I commented //this.sendInventory(); and //this.entry = -1; but it still doesn't work. The value printed in updateEntity still prints correct, but when I go to write it, it prints wrong before write. I did the same thing that I did to store values in 2 other tile entities, and I can't seem to find anything different going on here. Am I overlooking something, or is this just being obnoxiously picky and not working for some reason?
  3. Yes, I realized that I could later in the night after I completely changed it over to a regular block. I was trying to override createNewTileEntity like for a block container, instead of just createTileEntity. The new function I was using required it to have a Block Container anyways, so I just made it slow down the player and have no collision with the player to simulate a fluid. Either way, I have special parameters for whether or not it can be placed (i.e. in my multiblock structure), so It doesn't really matter in the end. Thanks for the reply though!
  4. Oh gosh, I just did this but for 1.7.10 a few days ago and it drove me nuts. Basically, I first get the orientation of my block and save a integer for left, right, back, front, top, bottom, according to the relationship to the direction I place my block: i.e. if my block is facing direction 4, then left = 2, right = 3, back = 5, top = 1, bot = 0, and front of course always = the .getBlockMetadata Then you more integers for each side (I just called it sLeft, etc for "sideLeft") and this is where you'll stray from me. I had a custom machine that based on my own slots for determining what side is what, but you of course would hook into the mod's api to get what texture is supposed to be there, and assign the "sLeft" or whatever side it in correlation to the mod api, and assign it values between 0-#of textures possible - 1 (because 0 is texture 1). Basically, for my mod I check for an Item in a certain slot, and assign number 0-2 based on what item it is, but once again, you have to check for what picture is clicked or whatever the mod does in API. remember at the end of the method that you got those values, to markDirty(). You need to call this method that gets the sides in relation to the orientation at the beginning of your updateEntity class. These are integers inside the tile entity. You need to write those (should be 12) to NBT, and read them from NBT. When they are writing and reading correctly (check with print statements), then you will need to add 3 more methods to your tile entity to handle packets and block updates. Then make sure you call the updateBlock method right after you call the side integers getting method inside the updateEntity. You need to check that worldObj.isRemote though, so remember that. Then in the Block class, you need to go to wherever 1.8 defines the side textures, and do if side == block.getTileEntity(x,y,z).left for left side (or .top for top, etc) and then inside of that if statement, if (block.getTileEntity(x,y,z).sLeft == 0 for left side texture 0 (or the first texture) and then in that if statement, put what the texture should return. Repeat process with all the possible .sLeft values, and then do more if statements for each side of the block. Once again, I haven't messed with 1.8 yet, so I don't know what has changed there, sorry for that. Honestly, if you want to see my code, I would be happy to show you. It was a PAIN for me to figure all of this out. It literally took me 3 days of coding straight and redoing things to get it to work. There is literally, like nothing out there to learn something like this. I know I explained this HORRIBLY, but there is really a lot of stuff going on. Maybe I'll make a proper video tutorial, but that is probably not going to happen. Maybe though. If I do, I'll post the link in here, but otherwise feel free to keep asking me questions and even ask for the code to look at, I honestly don't mind. I wish I could have had some proper documentation when I was trying this a few days ago.
  5. @Override public TileEntity createNewTileEntity(World world, int i) shows up as not overriding or implementing a supertype method inside of a BlockFluidClassic. So I have a custom liquid that I need to have a TileEntity for, but it looks as if that isn't possible??? If it isn't possible, then is there a way that I can make a normal block act like a fluid block, not including the flow or the liquid part of it? (The normal liquid doesn't flow / displace) Basically, I need a block that you can move through, but function like swimming / quicksand. I need to be able to toss an Item into it and have it detect either touching, or intersecting with the tile enitity. I have that part set up, and it works with the liquid as it stands right now. The liquid doesn't flow, and it can only be placed in a special "multiblock" structure. The problem is, I need NBT stored in it, for some refining purposes. I would prefer if the player could "swim" in it, but that doesn't necessarily have to be the case. So, am I better off using a transparent-ish Block for the liquid inside the structure, or is there a way to tie a TileEntity to a BlockFluidClassic? I decided to change up how I was going to refine the stuff. Although, it would be cool if you could store NBT in fluids!
  6. Ehh I figured it out, lol when I multiply the stuff removed by the speed, I must divide the total amount at the start by the speed. Lol I'm so stupid for not thinking this one through, good job me (and to think they placed me into Calc II for college this fall...)
  7. Uggh, It looks like I'm back again, haha. Ok, so I have a speed upgrade for my custom machine and I have a slot to install speed upgrades. My problem is the recipes work when there is no speed upgrade in. When I put the speed upgrade in, the values for the recipes don't return as intended. I'll use an example of a recipe. 25 cobblestone (1500 burn required) needs to be "smelted" with 2 paper (750 burn) for the ratio. Without speed upgrades, it should go at a rate of 50 per .updateEntity(), Input Paper 1 1500____750 1450____700 etc ____ etc When you add upgrades, it should speed up proportionally. Redstone is worth .2 to the speed so 1 redstone runs it at 1.2x speed. I can't seem to wrap my head around this math involved. I know it isn't: CookTime += this.cookTick * this.getSpeedRatio() BurnTime -= this.cookTick * this.getSpeedRatio() Because that makes it more efficient along with speedy (i.e. at speed ratio of 2, it runs twice as fast but also twice as energy efficient) How do I get the math right for this? As for code, if you REALLY need it, I can post it, but it's kinda messy right now after all my tinkering to fit in my new fuel system. I haven't reorganized it yet. But I honestly don't think you should need the code because its just replacing the standard 200 cook time of the minecraft furnace per recipe, grabbing based on the item instead of a flat rate for all items. EDIT: Here is some of the code, but I can't get the insert code to work lol... http://pastebin.com/ixwKaiBy
  8. Thank you, I did manage to get it to work by switching the !worldObj.isRemote to just worldObj.isRemote, like you said, do it in server and not client. However, is there still a good place to learn about server vs client side either specifically for minecraft or for java in general. I'm heading into computer science undergraduate for college this fall as a freshman, so everything so far has been self taught. I sure would like to get a better understanding of server vs client. From my experience here, it seems using a server side check makes it work inside the updateEntity(), but I don't know WHY that is, and so resources would be great if you, or anyone reading, has any for me to look at.
  9. Ok, I changed out the metadata integer for just worldObj()getBlockMetadata(xCoord, yCoord, zCoord), thanks for that tip! I removed the writeToNBT calling of my updateCircuitTextures(). The only problem is, I'm relatively new to server side vs client side / packet handling, so 2 questions: 1. Where can I learn about what functions are called server side and which are called client side, as well as which ones are updated regularly like the updateEntity() method ? (which from my understanding is client side) 2. Do you know one off the top of your head that I can put the updateCircuitTextures() into so I don't need it in the onBlockActivated() method?
  10. The metadata is being stored as a way to get directions Left, Right, Back, Top, and Bottom, in relation to the direction the block was placed, because I need to change textures based on those directions instead of north, south, east, west. That functionality works perfectly fine. As for using updateCircuitTextures() inside of writeToNBT, I was trying to find a way to update the textures automatically, instead of needing to use it in "onBlockActivated()" inside the block class. THIS even works fine, except it doesn't update the block until a relaunch of the save file, unless I use specifically, world.markBlockForUpdate(x,y,z) inside the block class. I want a way for it to update inside the tile entity, so that it automatically refreshes, or I can add a counter to refresh every so many ticks. Using worldObj.markBlockForUpdate() doesn't work, even when I add the updateCircuitTextures() to the onBlockActivated() method in the block. It just doesn't update it. I know using it in the NBT write sounds weird, but honestly, it is just 1 step before writing any of the NBT and then it gets ALL of the updated necessary integers needed to be stored. There is NOTHING wrong with using it here, it is just different from standard conventions, and I put it there because nothing else was working any differently, and it was my last attempt at getting it to work as intended.
  11. So I have my packet sending working for all my data, but the funny problem I am running into is I cannot use worldObj.markBlockForUpdate(xCoord, yCoord, zCoord) inside the updating of the texture method inside the custom TileEntity. What it requires me to do is: Somewhere in the block (only viable place is in onBlockActivated) run: Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(x, y, z); world.markBlockForUpdate(x, y, z); This has 2 problems. 1, I need it to update all the time (or at least every half a second or something), and second, it requires me to click on the block 2 more times before the texture finally updates. I don't know why it takes 2 times, but it does. Where can I move this code? I'm sick of posting snippets and then being asked for more of the code, so here are both the TileEntity and Block source: TE- http://pastebin.com/wa9jbSEb Block - http://pastebin.com/TmvzRFRG Also, in previous tests, I've used both: worldObj.markBlockForUpdate(xCoord, yCoord, zCoord) alongside Minecraft.getMinecraft().renderGlobal.markBlockForRenderUpdate(xCoord, yCoord, zCoord) but then anywhere inside the TileEntity that I put the updateCircuitTextures(), it returns a divide by zero error, which is fixed when ran without the renderGlobal update, but then it doens't actually update it until I relaunch the save file. So final question(s): Where can I safely put an update render/block method inside my TileEntity and have it update regularly, and if in a new method, where can I put that method to have it be updated regularly?
×
×
  • Create New...

Important Information

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