-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reimplement ItemStack Obfuscation (#11817)
Reimplementation of the itemstack obfuscation config that leverages the component patch map codec to drop unwanted components on items or replaces them with sanitized versions. Co-authored-by: Bjarne Koll <[email protected]> Co-authored-by: Jake Potrebic <[email protected]>
- Loading branch information
1 parent
efdcaa2
commit 55f3f28
Showing
17 changed files
with
521 additions
and
77 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
paper-server/patches/sources/net/minecraft/core/component/DataComponentPatch.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
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
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
26 changes: 26 additions & 0 deletions
26
...r/src/main/java/io/papermc/paper/configuration/serializer/ResourceLocationSerializer.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,26 @@ | ||
package io.papermc.paper.configuration.serializer; | ||
|
||
import java.lang.reflect.Type; | ||
import java.util.function.Predicate; | ||
import net.minecraft.resources.ResourceLocation; | ||
import org.spongepowered.configurate.serialize.ScalarSerializer; | ||
import org.spongepowered.configurate.serialize.SerializationException; | ||
|
||
public class ResourceLocationSerializer extends ScalarSerializer<ResourceLocation> { | ||
|
||
public static final ScalarSerializer<ResourceLocation> INSTANCE = new ResourceLocationSerializer(); | ||
|
||
private ResourceLocationSerializer() { | ||
super(ResourceLocation.class); | ||
} | ||
|
||
@Override | ||
public ResourceLocation deserialize(final Type type, final Object obj) throws SerializationException { | ||
return ResourceLocation.read(obj.toString()).getOrThrow(s -> new SerializationException(ResourceLocation.class, s)); | ||
} | ||
|
||
@Override | ||
protected Object serialize(final ResourceLocation item, final Predicate<Class<?>> typeSupported) { | ||
return item.toString(); | ||
} | ||
} |
Oops, something went wrong.