Skip to content
This repository has been archived by the owner on Aug 26, 2021. It is now read-only.

NBT for Entity-Capture Items #185

Closed
8 tasks done
Nerdpie opened this issue Feb 25, 2019 · 6 comments
Closed
8 tasks done

NBT for Entity-Capture Items #185

Nerdpie opened this issue Feb 25, 2019 · 6 comments
Labels
enhancement An improvement to an existing feature, or a new one integration Integration with another mod

Comments

@Nerdpie
Copy link
Contributor

Nerdpie commented Feb 25, 2019

Related to my suggestion regarding Roost, it may be useful to expose at least the type of animal captured in assorted items, albeit obnoxious due to the large variety, as I do not believe that a common interface or capability has been designed for such items. Examples that come to mind:

  • Cyclic's Monster Ball
  • EnderIO's Soul Vial
  • Hatchery's Animal Net
  • Not Enough Wand's Capturing Wand
  • Thermal Expansion's Morb
  • Industrial Foregoing's Mob Imprisonment Tool
  • Extra Utilities 2's Gold Lasso & Cursed Lasso
  • Vanilla spawn eggs (not sure if this counts, but I like the sense of progress)

Further complicating things, I believe that, at least in the past, some mods will store the entity's full NBT, while others only store the entity type; e.g. if you catch a villager, do you get the same trades, or just a random villager when you place them down.

Given the large number of variables (both figuratively and literally) I understand if this is impractical or feature creep, but I thought that I would suggest it nonetheless.

@SquidDev SquidDev added the enhancement An improvement to an existing feature, or a new one label Feb 25, 2019
@Nerdpie
Copy link
Contributor Author

Nerdpie commented Feb 26, 2019

Thinking about it some more, this does feel like an ideal spot for a custom capability to be defined, though I don't know what the best route to do so would be, especially as that would be outside of the scope of Plethora...

Somewhat rubber-ducking here, as this would work for both the original enhancement request and for a hypothetical capability:

  • isPreserved - Whether the entity NBT is preserved, or just the entity type is stored
  • getEntityType - The type of entity, e.g. cow, villager, zombie, etc.

Any further methods would depend upon whether we have entity NBT, and what type of entity has been captured, such as profession/trades for a villager, wool color for a sheep, growth/gain/strength for a Chickens chicken, etc. As such, each type of entity would need its own extension to the core metadata methods... This, along with the variety of entity capture items, is the core of my concern about feature creep...

@SquidDev
Copy link
Member

Plethora has an "object converter" system - we could definitely implement something which maps ItemStacks into some "captured entity" type.

As far as NBT goes, we can re-recreate the entity from that, and then we can just pass it off to our pre-existing entity metadata functions. This should mean we don't have to add too much new functionality, just piggyback off existing code.

SquidDev added a commit that referenced this issue Mar 4, 2019
Simply provides the current entity metadata within capturedEntity.

See #185
@SquidDev
Copy link
Member

SquidDev commented Mar 4, 2019

image
One down, a lot more to go!

@Nerdpie
Copy link
Contributor Author

Nerdpie commented Mar 5, 2019

Nice! Out of curiosity, what code are you using in the screenshot to test?
... and I just noticed that you captured a squid. XD

Edit: Having seen another screenshot on the Discord, I realized that your Lua interpreter is labeling the input/output line pairs; is that from CC:Tweaked, or is it a modified edit.lua? Main thing that is throwing me is that all of the output is nice and tidily aligned, but that may just be due to the tags not being nested...

@SquidDev
Copy link
Member

SquidDev commented Mar 5, 2019

Out of curiosity, what code are you using in the screenshot to test?

It's pretty much just peripheral.wrap("right").getItemMeta(1).capturedEntity.

I realized that your Lua interpreter is labeling the input/output line pairs; is that from CC:Tweaked, or is it a modified edit.lua?

Yeah - it's the modified Lua shell from mbs. Makes it a tad easier to read things IMO :).

@Nerdpie
Copy link
Contributor Author

Nerdpie commented Mar 5, 2019

That makes sense; much flatter structure than, say, the full meta for a bee that I was testing to determine the behavior of NamespacedMetaProvider.

MBS looks handy... that's going into the list of 'things I want to auto-install'!
ETA: The scrollback alone makes it a must-have!

@SquidDev SquidDev added the integration Integration with another mod label Apr 24, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement An improvement to an existing feature, or a new one integration Integration with another mod
Projects
None yet
Development

No branches or pull requests

2 participants