Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite <init> of ResourceLocation and add ResourceLocationInitEvent #95

Closed
wants to merge 1 commit into from

Conversation

Ecdcaeb
Copy link
Contributor

@Ecdcaeb Ecdcaeb commented Mar 17, 2024

result

    protected ResourceLocation(int unused, String... resourceName)
    {
        this(org.apache.commons.lang3.StringUtils.isEmpty(resourceName[0]) ? "minecraft" : resourceName[0].toLowerCase(Locale.ROOT), Objects.requireNonNull(resourceName[1].toLowerCase(Locale.ROOT), "the path of ResourceLocation is non-null!"));
    }

    public ResourceLocation(String resourceName)
    {
        this(0, splitObjectName(resourceName));
    }

    public ResourceLocation(String namespaceIn, String pathIn)
    {
        String[] s = net.minecraftforge.common.ForgeHooks.onResourceLocationInit(namespaceIn, pathIn);
        this.namespace = s[0];
        this.path = s[1];
    }

Event

ResourceLocationInitEvent, used for redirection or ...

```java
protected ResourceLocation(int unused, String... resourceName)
    {
        this(org.apache.commons.lang3.StringUtils.isEmpty(resourceName[0]) ? "minecraft" : resourceName[0].toLowerCase(Locale.ROOT), Objects.requireNonNull(resourceName[1].toLowerCase(Locale.ROOT), "the path of ResourceLocation is non-null!"));
    }

    public ResourceLocation(String resourceName)
    {
        this(0, splitObjectName(resourceName));
    }

    public ResourceLocation(String namespaceIn, String pathIn)
    {
        String[] s = net.minecraftforge.common.ForgeHooks.onResourceLocationInit(namespaceIn, pathIn);
        this.namespace = s[0];
        this.path = s[1];
    }
```
@kappa-maintainer
Copy link
Collaborator

You are adding a new event, please indicate this in title and explain more detail in description

@Ecdcaeb Ecdcaeb changed the title Rewrite <init> of ResourceLocation Rewrite <init> of ResourceLocation and add ResourceLocationInitEvent Mar 17, 2024
@Rongmario
Copy link
Member

This is a horrible idea, new ResourceLocation(...) happen so much, with events it'd lag immensely. I also do not see a point in events firing for this.

@Rongmario Rongmario closed this Mar 17, 2024
@Ecdcaeb
Copy link
Contributor Author

Ecdcaeb commented Mar 17, 2024

If i remove the event, is it ok?

@Ecdcaeb
Copy link
Contributor Author

Ecdcaeb commented Mar 17, 2024

This event is specially made for CraftTweaker/ContentTweaker#281

@kappa-maintainer
Copy link
Collaborator

Then this will become a meaningless one-line commit
As for your CoT issue, why not open PR there? Please don't bother loader with random mods' design flaw

@brachy84
Copy link
Member

This event is specially made for CraftTweaker/ContentTweaker#281

laughs in groovyscript

@TUsama
Copy link

TUsama commented Mar 17, 2024

你要是没活就去咬打火机,别整这些有的没的绣花枕头草包子,这儿不是你自家的花园。
交PR之前动动脑子,或者你直接去隔壁1.12.2联盟那边去那边发挥你的聪明才智,没人拦你。

@Ecdcaeb Ecdcaeb deleted the ResourceLocation branch May 2, 2024 02:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants