Jump to content

Abastro

Forge Modder
  • Posts

    1075
  • Joined

  • Last visited

  • Days Won

    2

Everything posted by Abastro

  1. Ah, yes, you don't need that. Sorry for causing confusion. The block rendering should be updated when the neighbor is changed. EDIT: Sorry, I didn't know that you extended the vanilla chest.
  2. Yes, there is a way. Override TileEntity::getUpdatePacket to write the sync packet, and override TileEntity::onDataPacket to read and apply the sync packet. You may want to override TileEntity::getUpdateTag and TileEntity::handleUpdateTag as well. Besides, TileEntity::readFromNBT won't be called by default.
  3. The hard part will be getting the enemy. How would you define the enemy? The target the player is attacking? The other part is easy: Entity::getDistanceToEntity(Entity). I don't know about official javadocs, but here's the official documentation for forge: http://mcforge.readthedocs.io/en/latest/
  4. ServerProxy is only applied on the dedicated server, like minecraftserver.exe. It's rarely needed. Just register server related stuff in your mod preinit/init/postinit.
  5. Yes, and everywhere else where update take in place.
  6. Where the tileentity rendering should be updated. Like updateContainingBlockInfo
  7. You need to update the rendering, call World::markAndNotifyBlock with flag 3.(the flag is explained on World::setBlock)
  8. Probably, override Block::onNeighborChanged? It has been several versions after I worked on tileentity, so my memory is not clear. But there should be similar method.
  9. Let the enum override IStringSerializable.
  10. Get it from the blockstate, it should be straightforward. About the rendering bug, do you detect whether the adjacent chest is removed?
  11. Yes. You don't need several blocks. About double chest:You need to detect adjacent chest placement on somewhere like Block#onNeighborChanged, and change field of both tileentities. About types: you can access blockstate on tileentity. Just put the chest type as blockstate. Also you need to configure the corresponding ItemBlock to apply the type on the block placement as well. EDIT: ninja'd
  12. One Tileentity is enough, as field in the TE can the color. Probably you can comfigure one chest TE to express the double one as well. (with isConnected or whatever) Do what you think is the best
  13. Make sure that don't put 0 or smaller integer in GenLayer::nextInt method. weight/10 could be causing this. Rendering seems to be related with sky renderer, please post the code.
  14. @T.S.White, yes that works. That's what I mean by 'your own solution'. It means you need to design some system for that. EDIT: You need to be careful, as it could be easily messed up and many issues can arise.
  15. Actually the name of the event is somewhat misleading. It is always called when attack key/mouse is pressed. Same for Item::onLeftClickEntity.
  16. It's impossible unless you check for every containers every tick. Also there are unloaded chests and tiles, mod-added bags, and such. You can't just rot those items continuously.
  17. There's easier way for that: subscribe event: PlayerInteractEvent.LeftClickEmpty. Do what you want there. When you want to block hitting an entity, you can just override Item::onLeftClickEntity.
  18. Yes. One drawback is that it can be detected continuously. I think you should take care of it manually.
  19. keyBindAttack doesn't work because the left click is already processed as attack. The game resets the pressed flag to false after the process, so you can't detect it when it's bound to attack. So do you want to detect attacking? If what you need is checking whether left click button is clicked or not, you can use KeyBinding::isKeyDown().
  20. If your double chest is rendered on one of the two blocks, (i.e. the other is invisible,) Override TileEntity::getRenderBoundingBox to return appropriate size of the double chest.
  21. It's impossible to get the container the item is contained within the Item class. It should be implemented in the container. It'll be hard to implement rotting in other containers, as you'd better not access all of them every tick. Also there is an issue with items in unloaded TileEntity. So you need to invent your own solution with that.
  22. What is your problem? Are you having hard time implementing it? You just need to nest NBTTagList, just like nested NBTTagCompound. Just use index instead of String key.
  23. Now you are spawning the item on both side. You shouldn't do that, only spawn it on server thread, check if World::isRemote is false for that. (So basically invert World::isRemote check)
  24. Yes, you have to pass the tileentity reference to the inventory capability. Usually item is inserted/extracted through the capability including hoppers and modded pipes, so it's the best place to check for inventory change and apply the comparator update. Besides, forget about doFill. It was about fluids.
×
×
  • Create New...

Important Information

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