Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Atijaf

Members
  • Joined

  • Last visited

Everything posted by Atijaf

  1. Packet Dispatcher http://pastebin.com/Ydv74KaB SyncCurrentMimicBlockState http://pastebin.com/VqRP80NQ CurrentMimicBlockState class http://pastebin.com/gjL6dCyC Thanks!
  2. Hmmm.. I thought it was fine after looking at it for a little bit. Unfortunately, it looks like it's not syncing to the server. What is suppose to happen is this.. Each player has nbt tag that holds an IBlockState Id. This Id is then used in my Tile Entity Mimic block to tell the block what to look like. (client side only) When I press shift, and f together, it checks the player's inventory to see if he has a block, and if so, copy that blocks state into the tile entity Mimic block. after that it is suppose to send message to the server, syncing the object. key Input method (doesn't work/ doesn't sync to server...) @SubscribeEvent public void onKeyInput(KeyInputEvent event){ EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (ClientProxy.keyBindings[0].isPressed()){ if (player.isSneaking() && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() != null){ ItemStack item = player.getCurrentEquippedItem(); Block block = Block.getBlockFromItem(item.getItem()); IBlockState state = block.getStateFromMeta(item.getMetadata()); CurrentMimicBlockState.get((EntityPlayer) player).setMimicBlock(state); PacketDispatcher.sendToServer(new SyncCurrentMimicBlockState((EntityPlayer) player)); } } } } setMimic command execute (works) public void execute(ICommandSender sender, String[] args) throws CommandException { if(args.length > 0){ CurrentMimicBlockState.get((EntityPlayer) sender).setMimicBlock(Block.getStateById(Integer.parseInt(args[0]))); } } setMimicBlock method public void setMimicBlock(IBlockState state) { this.state = state; } I have figured out that the server side is not in sync with the client side. The command works just fine, while the playerInput doesn't.. I don't know why
  3. Thanks:) Thanks for the help with getting the block from the item. And all that server talk made me think a little harder. I found the error and I'm good to go now! I was sending a packet to the client side instead of the server. Ooops!! Thanks again for all the help.
  4. I require the EntityPlayer from the event and the only way I know of getting a player is by using Minecraft.getMinecraft.thePlayer, which I think is incorrect... @SubscribeEvent public void onKeyInput(KeyInputEvent event){ EntityPlayerSP player = Minecraft.getMinecraft().thePlayer; if (ClientProxy.keyBindings[0].isPressed()){ if (player.isSneaking() && player.getCurrentEquippedItem() != null && player.getCurrentEquippedItem().getItem() != null){ Block block = Block.getBlockById(Item.getIdFromItem(player.getCurrentEquippedItem().getItem())); IBlockState state = block.getStateFromMeta(player.getCurrentEquippedItem().getMetadata()); CurrentMimicBlockState.get((EntityPlayer) player).setMimicBlock(state);//Crashes here.. I have tested it elsewhere and it works fine. } } } }
  5. You don't. TileEntities are only written to NBT when the world is being saved, at runtime you should use the TileEntity 's fields directly. Treat it like a normal Java object. Get the TileEntity at the Block 's position ( World#getTileEntity ), cast it to TileEntityMimicBlock and call the getState method on it to get the IBlockState that particular instance is mimicing. You are wonderful!!! I'm so use to reading it from nbt that I didn't even think about treating it like an object and just obtaining the state that way. Makes complete sense now. Thank you so much!
  6. How would I load the NBT Data from the current Tile Entity? I'm sorry.. I'm not quite sure I understand. I would pass the blockPos instead of the TileEntity? Thanks!
  7. Still nothing. Maybe it will help if I explain what I'm trying to do. I want a block that can mimic the look of another block. For example, I would mimic the look of stone, place it down, then mimic the look of grass, and place it next to the 'stone' block. Both would keep their original texture. I have found that this bit of code, public static int getTileStateId(TileEntity tile_entity){ return tile_entity.getTileData().getInteger("stateId"); } always returns 0 which is telling me that the tile doesn't have any data. tile_entity is found using blockPos.
  8. I appreciate the tip. You're completely right and that would make the code easier to follow. I will try setting a few breakpoints and find out what's going on.
  9. I have a tileEntity that holds an IBlockState value. This value is used to figure out what to render, but when I place the block, it doesn't see anything in the nbt with said tag. Basically, how do I obtain the information within the tile entity? Mimic Block class http://pastebin.com/uGUKsVYM TileEntity Mimic Block class http://pastebin.com/QvZi553P
  10. I am going to open a new thread that better suits my issue. I believe the topic has been answered on this forum. Here's where I moved it http://www.minecraftforge.net/forum/index.php/topic,32777.0.html [solved] Thanks for all the help!
  11. How would I use an ISmartBlockModel with a tileEntity?
  12. This block could mimic any texture of any blocks. Also, this block would keep it's original texture when it was placed. Example: I place this block down and it'll mimic the texture of sand. I place this block down again, but this time, it'll mimic the texture of stone. Both blocks will keep their textures. Here is what I have. TileEntity Block Class http://pastebin.com/QvZi553P Block Class http://pastebin.com/uGUKsVYM How would I obtain the texture for each block, telling the renderer what to render?
  13. Funny enough. I haven't messed with Tile Entities as much as I wish I had. I looked up a tutorial and I have a TileEntity class for my block now. What kind of class fields would I put into my TileEntity class? And would I use nbt data? My Mimic Block class http://pastebin.com/uGUKsVYM My Tile Entity Mimic Block class http://pastebin.com/QvZi553P Thanks for the prompt replies.
  14. Alright. I've got it working. There may be a fatal flaw as to what I want. When I place this block, it looks like stone. (What I want it to look like for current purpose) I now change it to look like a snow block. When I place this block, it looks like a snow block... But it also updates the block that I placed before into looking like a snow block. I'm wanting the two blocks that I placed down to look like they did originally. Is that possible?
  15. Will take a look at that. Thanks!
  16. That sounds promising. I haven't touched ISmartBlockModels or IBakedModels. Would you happen to know if there are any tutorials out there? I'll be looking around. Thanks
  17. Would it be possible to create a block the mimics the texture of any block I want? This one block would be able to take on any textures... So it could look like grass, stone, sand(without the attributes of falling). Is that possible? I wanted to make a minecraft world with structures that are unbreakable. I am hoping to be able to use a command to change the texture of this block.
  18. Hey coolAlias! I was wondering when you'd show up:p Thanks again for your help, and thanks for the tutorial on IEEP. It's gotten me thus far. As for your tip, it worked wonders. And thanks diesieben07, I very greatly appreciate all the help you have given me throughout this learning experience. I'll be back sooner or later. Haha. For those that are reading this, I have updated those pastebin Links to show what Is currently working for me. buh bye.
  19. I was about to update my last reply, but realized your prompt response. I appreciate that! Very strange, It seems that it is running through the read method now. One moment while I look at it please! Got it working! For the most part. Just a quick question though if you don't mind. I have a for loop to go through my list of data. for(int i = 0; nbt.getIntArray("myBlockPos" + i) != null; i++){ //obtain info } nbt.getIntArray never returns null though. Is there another way to check if it contains no information?
  20. Okay. I removed the event. When I run the command for the first time, it creates a new instance of WorldData, adds information to it, then sets it dirty. I save and quit the game. The second time, it still creates a new instance. Is that suppose to happen? It doesn't have any data stored in it, nor does readFromNBT get called.
  21. I need the data it holds to load when the server starts
  22. That deffinately did something. I debugged and it walked through all the saving of the class after I set it dirty. It then set the dirty boolean back to false. I believe my event handler is wrong now. Any Ideas? This is the event now. It doesn't find anything in the get method with the given identifier and world. http://pastebin.com/KCdMq01Z Thank you for everything you've done.
  23. So I have a list of locations called myBlockPos. myBlockPos has private variables named, BlockPos, IBlockState, and int. It is used to let blocks respawn in said locations. While in the game, I use a command, fill in the required information, and store it in myBlockPos. Now to the problem. It doesn't save. Data is added, I set the instance's dirty boolean to true, but after I reset minecraft, it isn't there anymore... In other words, the get method doesn't find anything with the given identifier and it creates a brand new instance. Thanks! Edit: SOLVED Current classes: WorldData http://pastebin.com/iRLVfB6g Command http://pastebin.com/s0LaLxs1
  24. All I can figure out is that the method "readFromNBT(NBTTagCompound nbt) is not getting called automatically, but when I manually call it, nbt has nothing saved in it. Am I suppose to register WorldData? or just use the method "public static WorldData get(World world). Also, when the command to set a few variables is used and I use the method "nbt.setTag(Identifier, tagList)" nbt gets data, and then closes. If I call the method again, nbt has no data again, as if I never used the command once. It's weird...
  25. Thanks for explaining that. That's what I was worried about... I am thinking that I probably missed something obvious near the beginning. After I use markDirty(), it sets dirty to true. I then save it. Re enter the command to add more data and before it even gets to the mothod, markDirty(), dirty is still true. (I'm gussing dirty is suppose to be switched back to false when it saves) I will look at my code for a while and possibly make a new thread that deals more with WorldSavedData.

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.