[WIP] CloneMe - Create clones of yourself [Alpha released]

Discussion in 'WIP and Development Status' started by ZachBora, Jan 1, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    ZachBora

    It's a plugin I'm working on to help build, gather resources and maybe other things later on.
    What it consists of is creating clones of yourself that will do the same action as you just did but with a Translation (x,z,y) AND/OR Rotation (90/180/270) AND/OR "Mirror" (North/South and West/East).

    It has a soft depend on the plugin NPCCreatures. (Means you don't need to get it, but you won't see your clones.)

    Plugin page (Alpha release) : http://dev.bukkit.org/server-mods/cloneme/
    Source : https://github.com/ZachBora/CloneMe

    Still to do :
    • Fix block rotation (doors, stairs, etc.) Minor Update: Done for Rotation, still Mirror to do.
    • Remove from the player's inventory blocks placed by his clones if not in creative mode. Minor Update: Done, but a few bugs to fix
    • Add to the player's inventory blocks broken by his clones if not in creative mode. Minor Update: Done, but at the moment it gives the block broken, not what you're supposed to get when breaking it.
    • Possibly tie to some economy plugin. Low priority, if someone requests it.
    • Better clone handling. Right now they push you around even when you're not done setting them up. Also need to add commands to modify existing clones.
    • Better administration of clones. At the moment there's only a command to remove all clones from everyone. Not specific people.
    • Create premade clone sets. Example: automatically make a 90degree, 180degree and 270degree clone with 1 command.
    You can see a working example in this video :
     
    Cowboys1919, Kohle, Technius and 6 others like this.
  2. Offline

    Windwaker

    Wow, very awesome. Bravo :)
     
  3. Offline

    ZachBora

    I'm having two problems at the moment.

    I need to add verification so where the clones place a block is allowed by the player. The most plausible way would be to create a new BlockBreak or BlockPlace event. But since these are created while inside a BlockBreak and BlockPlace event we don't want events to loop infinitly. So don't really know how to handle that. Now once that is dealt, I also need to tell the player if one of the clones can't place the block, and maybe rollback the changes.

    My other problem is that if I want to reduce the item the player places by the number of clones and himself, I need to remove an item from his inventory. Right now I am only seeing functions to remove(Material). They don't have Material, Data. Which is somewhat ridiculous, it should have had that added ages ago. There isn't even a Contains(Material, Data). Sure there is Contains(new ItemStack(Material, quantity, Data)) but that is hardcoding the quantity and will mostly always return false. I can do Add(new ItemStack(Material, -1, Data)) but that doesn't validate if the player has any of it left. In last resort, I'll get all the player's itemstacks and loop, but that doesn't feel right, it's like reinventing the wheel.
     
  4. This is brilliant ! :D
     
  5. Offline

    DrBowe

    Hot damn, this is one of the greatest things I've ever laid my eyes upon. This will make building so much easier.
    Brilliant, man!
     
  6. Offline

    md_5

    @ZachBora

    Nice, now please tell me the title song is what I think it is :)
     
  7. Offline

    ZachBora

    Intro is from Naruto, Fighting spirit in midi format.

    From Bassic - Daydreamer 2004
    Rain
    Powder Snow
     
  8. Offline

    md_5

    I swear it was something else.
     
  9. Offline

    ZachBora

    Last edited by a moderator: May 22, 2016
  10. Offline

    ZachBora

    Problem fixed thanks to @Shamebot ! Going to get an Alpha version out by tomorrow.

    It still needs to be approved but since I lack time, I will post right now. I won't be able to work on the plugin until Monday or Tuesday night.
    http://dev.bukkit.org/server-mods/cloneme/

    I fixed some bugs with survival mode, but won't get any more time for fixes until Monday/Tuesday.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
    Technius likes this.
  11. Offline

    Suprem20

    The rotation of objects like stairs, furnaces, chests is usually wrong. The clone places them using your position, it needs to be reflected. Water/Lava buckets can't be used by clones, it's annoying.
     
  12. Offline

    ZachBora

    I see I see... I'll need to hardcode stuff for bukkits and stairs.
    For reflection I'll do something too. Rotation works pretty well though... hadn't tested reflection a lot.
     
  13. Tu ne serais pas français par hasard ? :p
     
  14. Offline

    ZachBora

    Quebecois, but this isn't the place to talk about it.
     
  15. Was just to say I'll write an article for this plugin on Minecraft.fr, hope it could advertise it.
     
  16. Offline

    Nathan C

    Holy cow, this looks amazing!
     
  17. Offline

    ZachBora

    You can but you should at least wait for a more stable version. There's lots of bugs right now.
     
  18. Amazing plugin! That's a really cool and unique idea.

    I'd like to report some bugs I noticed:
    1. teleport events don't trigger updates of your clones (you only see them move to the correct location when you move again)
    2. in survival, when a clone destroys a block you get the actual block added to the inventory instead of what the block would drop (example: cobblestone when breaking stone; coal item when breaking coal ore)
    3. in survival, when a clone wants to place a block where the same block type is already present, you still get the block subtracted from your inventory; this also applies to when you have a mirror clone and you are both placing a block at the same location
    4. same as above, just with block breaking when breaking the same block; you stand face-to-face with your clone, there is a dirt block in between you, you break it (the clone too) -> you get 2 dirt blocks
    5. clones override existing blocks when placing down a block (doesn't apply for some non-solid placed blocks, e.g. torches; i guess that's a special handling of yours)
    I think you would be better off using net.minecraft.server (NMS) classes/methods more often instead of trying to emulate the expected behavior (that's a really hard task).

    For 3.: I'm pretty sure there is a NMS method in net.minecraft.server.Block to get the dropped block type.

    You could also go one lever deeper and just fully simulate interactions (right-click, left-click). Then the server would care about everything involved: firing the event, dropping blocks, setting blocks.

    I don't know if you even want the plugin to go in that direction, though. Anyway, good job!
     
  19. Offline

    ZachBora

    I'd love to use NMS methods for place and break. I currently use it for interact and have a huge bug with it that I fear will be repeated with break and place if I ever find how to do them.

    You see, at the moment I send to interact the player. This contacts his current location and affects which wait fence doors open when interacted with them. I tried to temporily change the player's location (using the NMS method) and it threw player moved to fast problem (I'll have to test it with the bukkit method too, but I'm pretty sure it would be bad).

    So, if it works the same way as the NMS.block.interact, it will make stairs and other blocks like that be placed in the wrong direction.

    I will look into the "get dropped block type" though.
     
  20. Most of the NMS methods (only checked for Block and Item ones) only requires an EntityHuman, not a whole EntityPlayer. I think NPC libraries already use a subclass of EntityHuman for their NPCs (might only be EntityLiving, though, not sure, but it would make sense since NPCs are indeed humen).
    So you could call those methods with the actual NPC entity instances and not the player one. Just a thought, but I think it could work.
     
  21. Offline

    ZachBora

    There's just one thing, if we use an EntityHuman how does it know if it can place and break a block or not? Does it go by NPC name? Would I need to put the entity's name to the player's temporarily just for when I break things so plugins keep up with that or will that not trigger at all plugin protections?

    Currently I'm sending a block break event and if it returns that it can't break I don't break it. But it doesn't seem to work all the time. Mainly it acts different for Spawn protection and WorldGuard protection.
     
  22. I will :p
     
  23. Offline

    ZachBora

    I follow Eyce38 and TheFantasio974 on youtube.
     
  24. Can't really offer a solution here, but I think the NMS methods taking EntityHuman don't "know" if the given entity can place the block, they just don't care and just execute the action (put blockid i with metadata j at location x y z).
    I couldn't find the spot where CraftBukkit for example calls the BlockBreakEvent.
    This is the packet processing method I found: https://github.com/Bukkit/CraftBukk...t/minecraft/server/NetServerHandler.java#L434
    I can't track any event calling from there (I might have overlooked something), so it might be even before that ...
     
  25. Offline

    BioRage

    That's trippy, but amazing..

    Good work
     
  26. Offline

    ZachBora

  27. Holy shit, amazing!

    If you want to release the source, I could do a couple pulls to fix some of those issues :)

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
  28. Offline

    ZachBora

    I'll think about it tonight. Reason I haven't up to now isn't because I don't want it stolen (that is obvious to anything) it's because it hasn't been cleaned much.
     
  29. Very true, with a project like this I would also be weary. Good luck!
     
  30. Offline

    ZachBora

    By the way tips, I started Monday working on the mirroring fix and noticed a bug with Chests, Furnaces, etc. They don't take the Data parameter properly when setting the block. Any idea what'd cause that? WorldEdit's //set does the same problem.
    I haven't tried setting the block and the data later but it might be worth trying. It doesn't affect stairs and doors (even door top part works!), only the "Chest, Dispenser, Furnace" (Wall signs work) section of data values (See the Data section on them here http://www.minecraftwiki.net/wiki/Data_values)

    Well it's not too bad. There's :
    - The plugin class
    - Clone class
    - A scheduler class for block breaks, place, interact (When you place a block, the block data in the BlockPlace event isnt the final block data, so I put up a task 1 millisec after)
    - Player and Block listeners classes

    Added source and a few updates on the first post.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 22, 2016
Thread Status:
Not open for further replies.

Share This Page