-
-
Notifications
You must be signed in to change notification settings - Fork 187
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
ddfb94c
commit 5c37aba
Showing
9 changed files
with
121 additions
and
31 deletions.
There are no files selected for viewing
11 changes: 11 additions & 0 deletions
11
patches/net/minecraft/core/component/DataComponentMap.java.patch
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,11 @@ | ||
--- a/net/minecraft/core/component/DataComponentMap.java | ||
+++ b/net/minecraft/core/component/DataComponentMap.java | ||
@@ -126,7 +_,7 @@ | ||
}; | ||
} | ||
|
||
- public static class Builder { | ||
+ public static class Builder implements net.neoforged.neoforge.common.extensions.IDataComponentMapBuilderExtensions { | ||
private final Reference2ObjectMap<DataComponentType<?>, Object> map = new Reference2ObjectArrayMap<>(); | ||
|
||
Builder() { |
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
21 changes: 21 additions & 0 deletions
21
...ain/java/net/neoforged/neoforge/common/extensions/IDataComponentMapBuilderExtensions.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,21 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.common.extensions; | ||
|
||
import java.util.function.Supplier; | ||
import net.minecraft.core.component.DataComponentMap; | ||
import net.minecraft.core.component.DataComponentType; | ||
import org.jetbrains.annotations.Nullable; | ||
|
||
public interface IDataComponentMapBuilderExtensions { | ||
private DataComponentMap.Builder self() { | ||
return (DataComponentMap.Builder) this; | ||
} | ||
|
||
default <T> DataComponentMap.Builder set(Supplier<? extends DataComponentType<T>> componentType, @Nullable T value) { | ||
return self().set(componentType.get(), value); | ||
} | ||
} |
20 changes: 20 additions & 0 deletions
20
src/main/java/net/neoforged/neoforge/common/extensions/IItemPropertiesExtensions.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,20 @@ | ||
/* | ||
* Copyright (c) NeoForged and contributors | ||
* SPDX-License-Identifier: LGPL-2.1-only | ||
*/ | ||
|
||
package net.neoforged.neoforge.common.extensions; | ||
|
||
import java.util.function.Supplier; | ||
import net.minecraft.core.component.DataComponentType; | ||
import net.minecraft.world.item.Item; | ||
|
||
public interface IItemPropertiesExtensions { | ||
private Item.Properties self() { | ||
return (Item.Properties) this; | ||
} | ||
|
||
default <T> Item.Properties component(Supplier<? extends DataComponentType<T>> componentType, T value) { | ||
return self().component(componentType.get(), value); | ||
} | ||
} |
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