-
Notifications
You must be signed in to change notification settings - Fork 93
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Loading status checks…
Merge remote-tracking branch 'origin/2002' into 2004
# Conflicts: # fabric/src/generated/resources/kubejs.accesswidener # src/main/java/dev/latvian/mods/kubejs/core/LazyComponentKJS.java # src/main/java/dev/latvian/mods/kubejs/core/mixin/common/CommandSourceStackMixin.java # src/main/java/dev/latvian/mods/kubejs/item/custom/SmithingTemplateItemBuilder.java # src/main/java/dev/latvian/mods/kubejs/neoforge/KubeJSEntryPoint.java # src/main/resources/kubejs.accesswidener
- Loading branch information
Showing
17 changed files
with
386 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
src/main/java/dev/latvian/mods/kubejs/core/LazyComponentKJS.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package dev.latvian.mods.kubejs.core; | ||
|
||
import net.minecraft.network.chat.Component; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@FunctionalInterface | ||
public interface LazyComponentKJS extends Supplier<Component> { | ||
Component get(); | ||
} |
30 changes: 30 additions & 0 deletions
30
src/main/java/dev/latvian/mods/kubejs/core/mixin/common/CommandSourceStackMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
package dev.latvian.mods.kubejs.core.mixin.common; | ||
|
||
import dev.latvian.mods.kubejs.core.LazyComponentKJS; | ||
import dev.latvian.mods.rhino.util.HideFromJS; | ||
import dev.latvian.mods.rhino.util.RemapPrefixForJS; | ||
import net.minecraft.commands.CommandSourceStack; | ||
import net.minecraft.network.chat.Component; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.Unique; | ||
|
||
import java.util.function.Supplier; | ||
|
||
@Mixin(CommandSourceStack.class) | ||
@RemapPrefixForJS("kjs$") | ||
public abstract class CommandSourceStackMixin { | ||
@Shadow | ||
@HideFromJS | ||
public abstract void sendSuccess(Supplier<Component> supplier, boolean bl); | ||
|
||
@Unique | ||
public void kjs$sendSuccess(Component component, boolean broadcastToAdmins) { | ||
kjs$sendSuccessLazy(() -> component, broadcastToAdmins); | ||
} | ||
|
||
@Unique | ||
public void kjs$sendSuccessLazy(LazyComponentKJS component, boolean broadcastToAdmins) { | ||
sendSuccess(component, broadcastToAdmins); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.