GithubHelp home page GithubHelp logo

Comments (9)

nylhus avatar nylhus commented on September 25, 2024

Seems like something I could do

from skript.

moraedu avatar moraedu commented on September 25, 2024

Seems like something I could do

You'd have to expose the data field in NewBlockValues and only then do something along the lines of:

itemtype.stream(event)
.flatMap(ItemType::getTypes)
.map(item -> {
    NewBlockValues blockValues = (NewBlockValues) item.getBlockValues();
    return blockValues.getBlockData(); // exposed method
})
.toArray(BlockData[]::new);

from skript.

TheLimeGlass avatar TheLimeGlass commented on September 25, 2024

@nylhus This has been on my todo list, but you can take it.

Essentially you would use the BlockStateMeta in Bukkit and apply it to an itemstack.
I have the exact syntax in Khoryl, and I was planning to add to Skript eventually. https://github.com/TheLimeGlass/Khoryl/blob/master/src/main/java/me/limeglass/khoryl/elements/item/EffApplyBlockStateItem.java

This allows for

set {_shield} to a shield
target block is a lime standing banner #can have banner patterns
apply the block state from the target block of player to {_shield}
set the offhand of the player to {_shield}

Do note that using itemtypes in the pattern does not work properly. I would recommend making it itemstack only!
ItemType's store their ItemMeta until applied to an ItemStack, and when we utilized this syntax, we found out that itemtypes did not save the block state for some reason.

For this reason, I made it an expression which acts just like ExprLore and applies it like an expression returning the ItemStack. (Changes not applied to the Khoryl remote repo yet)

Similarly to BlockStateMeta there is also BlockDataMeta which is essentially the exact same class just for BlockData.

from skript.

Fusezion avatar Fusezion commented on September 25, 2024

I believe the BlockStateMeta is off topic for what I wanted this suggest to be. You're taking it as should we add it to give player westward facing oak stairs all I want here is send blockdata of westward facing oak stairs. The addition of that should be left to another issue or pr.

from skript.

TheLimeGlass avatar TheLimeGlass commented on September 25, 2024

I believe the BlockStateMeta is off topic for what I wanted this suggest to be. You're taking it as should we add it to give player westward facing oak stairs all I want here is send blockdata of westward facing oak stairs. The addition of that should be left to another issue or pr.

They're very close to being the same class and the implementation is the same, it's a developer note.

from skript.

Fusezion avatar Fusezion commented on September 25, 2024

I don't see how it's the same class, you're modifying 1 class not multiple. It's just going to ExprBlockData and adding itemtype and it's usage. You're suggesting it being done directly to ItemType class from what I understand

from skript.

TheLimeGlass avatar TheLimeGlass commented on September 25, 2024

I don't see how it's the same class, you're modifying 1 class not multiple. It's just going to ExprBlockData and adding itemtype and it's usage. You're suggesting it being done directly to ItemType class from what I understand

No, I said it shouldn't be done with ItemType.

from skript.

Fusezion avatar Fusezion commented on September 25, 2024

Alright, so now I'm even further confused what you're talking about after rereading it.

  1. This suggest is to add block data of %itemtype% nothing about BlockStates
  2. if any form of change to item meta is to happen it's BlockDataMeta to support westward facing oak stairs to also fix issues like give play oak wall sign not giving an item, which I repeat is better for a whole other issue and pr.
  3. Your idea is way off of what I want this issue to even do...and am very confused where you got it from this.

from skript.

TheLimeGlass avatar TheLimeGlass commented on September 25, 2024

Alright, so now I'm even further confused what you're talking about after rereading it.

1. This suggest is to add `block data of %itemtype%` nothing about BlockStates

2. if any form of change to item meta is to happen it's BlockDataMeta to support `westward facing oak stairs` to also fix issues like `give play oak wall sign` not giving an item, which I repeat is better for a whole other issue and pr.

3. Your idea is way off of what I want this issue to even do...and am very confused where you got it from this.

BlockStateMeta and BlockDataMeta are very similar classes. I have an existing example using BlockStateMeta for banner data.

I get that this suggestion is BlockDataMeta, I'm helping aid an example of usage, you just swap BlockStateMeta for BlockDataMeta.

from skript.

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.