Giter Site home page Giter Site logo

in survival with op about nbt-editor HOT 5 CLOSED

ilobilo avatar ilobilo commented on September 16, 2024
in survival with op

from nbt-editor.

Comments (5)

mega12345mega avatar mega12345mega commented on September 16, 2024

There isn't currently a way to do this. The main issue is that (server-side) commands are limited in characters, so automatically calling a command like /item replace entity @s inventory.<slot> with <item> would be restricted to very simple items. In theory it could automatically call /gamemode creative, then send the item set packet, then /gamemode survival, but that isn't ideal.

While anything that modifies your inventory doesn't work, the mod currently already supports the client chest, which would allow you to transfer items from a survival server (no op required), but not to a survival server. I believe you can also edit items within the client chest, but I haven't tried it. In theory it should work though. Obviously that isn't really what your looking for.

In theory nbt can be "built" by running successive /data modify|merge commands on nbt storage. However it would probably be very slow. It would also require a container or entity as an intermediary to transfer the item from nbt storage back into your inventory. Basically this would be automated:

  1. /data modify storage nbteditor:username_rand item set from entity @s Inventory[{Slot:<slot>}]
  2. Repeatedly, keeping chars under limit: /data modify storage nbteditor:username_rand <changes in nbt here>
  3. /data remove storage nbteditor:username_rand item.Slot
  4. /summon pig ~ ~ ~ {"nbteditor:username_rand":1b}
  5. /item replace @e[type=pig,nbt={"nbteditor:username_rand":1b},sort=nearest,limit=1] armor.head with stone
  6. /data modify entity @e[type=pig,nbt={"nbteditor:username_rand":1b},sort=nearest,limit=1] Inventory[0] merge from storage nbteditor:username_rand item
  7. /data remove storage nbteditor:username_rand item
  8. /item replace entity @s inventory.<slot> from entity @e[type=pig,nbt={"nbteditor:username_rand":1b},sort=nearest,limit=1] armor.head
  9. /kill @e[type=pig,nbt={"nbteditor:username_rand":1b},sort=nearest,limit=1]

This also doesn't work if the entire path and value of a single tag is longer than the limit (mainly a problem in long strings).

Is there a particular technique mentioned above that you want me to try implementing?

from nbt-editor.

ilobilo avatar ilobilo commented on September 16, 2024

I found another nbt editor plugin: https://github.com/qyl27/NBTEdit, it's not as easy to use but it just needs op and can edit items in survival mode. I don't know much of java and can't find how they do it but i think it could be useful to you.

from nbt-editor.

mega12345mega avatar mega12345mega commented on September 16, 2024

It looks like that mod is both client-side and server-side, so it only works on modded servers that include that mod (or singleplayer). Mods that are on both the client and server are much more powerful, as they can have things like a custom survival mode item editing packet. Generally I would like to keep this mod fully client-side, as it gives more flexibility to where it can be used; it works in vanilla servers, and even forge servers that don't require client side mods.

I have been considering making this mod server-side optionally, meaning that all of the current features still work, but special features like survival-mode editing, entity editing, etc. would be added. I'll look into the concept some more, but I can't guarantee it will come out soon; I don't have much experience with client-server communication in mods.

from nbt-editor.

ilobilo avatar ilobilo commented on September 16, 2024

That would be great, thanks!

from nbt-editor.

mega12345mega avatar mega12345mega commented on September 16, 2024

I've now added this in v2.0.0!

from nbt-editor.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.