MCreator icon indicating copy to clipboard operation
MCreator copied to clipboard

Added custom entity data parameters

Open Goldorion opened this issue 4 years ago • 11 comments
trafficstars

This PR adds support for custom entity data accessors (data parameters in 1.16.5). When this PR will be merged, I will add support for having multiple textures. I split them because this PR is already big enough I think.

Here is an example of the feature in action (using custom code to change the texture):

https://user-images.githubusercontent.com/38427877/142136416-10809d04-c37f-40dd-986e-e4fd4e16224b.mp4

I also added a procedure template, so users can have a small example to understand it.

Note: If you have better ideas for texts, I take the suggestions. Note 2: Concerning procedure blocks, I tried to make the easiest thing, but I'm also not sure of my approach. image

Goldorion avatar Nov 17 '21 04:11 Goldorion

I'd implement this like item properties: a list of [accessor-defaultvalue] and a list of [accessorscombination-texture]. But the PR will then need the StateEditor to define combinations list, I consider separating it from my current PR.

Defeatomizer avatar Nov 17 '21 12:11 Defeatomizer

I'd implement this like item properties: a list of [accessor-defaultvalue] and a list of [accessorscombination-texture]. But the PR will then need the StateEditor to define combinations list, I consider separating it from my current PR.

Entity data params are not only used for different textures. They are values stored in the entity that can be changed. So I don't want to limit this PR to textures only.

Goldorion avatar Nov 17 '21 15:11 Goldorion

Entity data params are not only used for different textures... So I don't want to limit this PR to textures only.

I was thinking the same way about block states: you can then replace all possibly data-dependent entity settings with procedure selectors, but it's a job for another pull. I suggested textures so that we could finally support #129.

Defeatomizer avatar Nov 17 '21 17:11 Defeatomizer

I suggested textures so that we could finally support #129.

I will make another PR after this one will be merged. It's another feature, so it has to be another PR. ;)

Goldorion avatar Nov 17 '21 17:11 Goldorion

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Do not remove this label manually, it should be removed by the bot when new activity occurs.

stale[bot] avatar Dec 01 '21 18:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Do not remove this label manually, it should be removed by the bot when new activity occurs.

stale[bot] avatar Dec 15 '21 19:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Do not remove this label manually, it should be removed by the bot when new activity occurs.

stale[bot] avatar Dec 30 '21 00:12 stale[bot]

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Do not remove this label manually, it should be removed by the bot when new activity occurs.

stale[bot] avatar Jan 16 '22 22:01 stale[bot]

I added support for Logic and String values. I didn't add extra procedure blocks for them because the current code already supports every variable type.

Goldorion avatar Mar 09 '22 23:03 Goldorion

Is it intended that entity/data_type.md is not translated into French? :D

Nope, I forgot it. Thanks :)

Goldorion avatar Mar 14 '22 22:03 Goldorion

The selected item is not changed though. It keeps the value from the other entity...

I'm personally out of ideas how to fix this.

Defeatomizer avatar Jul 03 '22 15:07 Defeatomizer

Is the procedure template still needed, @Goldorion?

Defeatomizer avatar Jan 23 '23 12:01 Defeatomizer

Is the procedure template still needed, @Goldorion?

I will have to test what you have done. I only checked quickly files at the moment.

Goldorion avatar Jan 23 '23 12:01 Goldorion

Please merge master into this PR

KlemenDEV avatar Feb 14 '23 18:02 KlemenDEV

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. Do not remove this label manually, it should be removed by the bot when new activity occurs.

stale[bot] avatar Mar 11 '23 14:03 stale[bot]

image

Entity type and parameter fields should be at the appropriate location, not at the end of the procedure

KlemenDEV avatar Apr 15 '23 19:04 KlemenDEV

Hmm, this is possible intriguingly...

Defeatomizer avatar Apr 15 '23 21:04 Defeatomizer

One way is making a Blockly field type and registering it, but there may be others. But it is quite hard to understand in the order they are right now

KlemenDEV avatar Apr 16 '23 07:04 KlemenDEV

This is a message that applies to all MC-code-related PRs. 1.18.2 generator was removed so in case this PR did not do this already, two actions are needed:

  • 1.18.2 generator support needs to be removed
  • 1.19.4 generator support needs to be added

If those changes were already applied, this message can be ignored.

KlemenDEV avatar Apr 25 '23 16:04 KlemenDEV

Can someone mark this as RFR?

Defeatomizer avatar May 03 '23 17:05 Defeatomizer

@Defeatomizer, couldn't parts of #2000 be used here, such as DataProperty so we don't make multiple similar systems?

KlemenDEV avatar May 26 '23 15:05 KlemenDEV

Goldorion said this PR only intended to add data accessors as such, not some other features (e.g. switching entity textures) that would need the suggested changes. But just to show what I thought would be used by block states, I could surely do these changes when I get time for it.

Defeatomizer avatar May 26 '23 15:05 Defeatomizer

I meant things like EntityDataEntry could probably re-use PropertyData

KlemenDEV avatar May 26 '23 16:05 KlemenDEV

Hmm, this inner class specifies default values for each type, so I'd highly likely need to add support for their definition directly via PropertyData and its subclasses.

Defeatomizer avatar May 26 '23 16:05 Defeatomizer

I suggest this waits for #2000 and then PropertyData is re-used. I thought the initial plan was already to use PropertyData for all property-related stuff, otherwise, it would be probably called ItemPropertyData.

But ofc it makes sense to extend this object later, not in #2000 where those features are not needed yet.

Or maybe extend PropertyData with default value support so default value is not serialized for item properties where it is not needed.

KlemenDEV avatar May 26 '23 16:05 KlemenDEV

That could work, but again, matter of time.

Defeatomizer avatar May 26 '23 16:05 Defeatomizer

I thought the initial plan was already to use PropertyData for all property-related stuff

PropertyData system was more/less shaped after this PR was opened :P

Defeatomizer avatar May 26 '23 16:05 Defeatomizer

I know I know, I am not judging the PR, just putting ideas on the table :)

KlemenDEV avatar May 26 '23 16:05 KlemenDEV

Can you draft this then?

Defeatomizer avatar May 26 '23 16:05 Defeatomizer

Goldorion said this PR only intended to add data accessors as such, not some other features (e.g. switching entity textures) that would need the suggested changes.

Not inside this PR because it's another feature, but I clearly want to add this as soon as it's possible 9so when this PR is merged)

Goldorion avatar May 26 '23 16:05 Goldorion