Possibility to add NBT data for Infusion recipes output (#215)

This commit is contained in:
Aleksey 2021-06-30 16:20:16 +03:00
parent 13e169c458
commit 3f225c59a1
5 changed files with 38 additions and 25 deletions

View file

@ -17,11 +17,10 @@ import ru.bclib.util.ColorUtil;
import ru.betterend.registry.EndParticles;
public class InfusionParticleType extends ParticleType<InfusionParticleType> implements ParticleOptions {
public static final Codec<InfusionParticleType> CODEC = ItemStack.CODEC.xmap(itemStack -> {
return new InfusionParticleType(EndParticles.INFUSION, itemStack);
}, infusionParticleType -> {
return infusionParticleType.itemStack;
});
public static final Codec<InfusionParticleType> CODEC = ItemStack.CODEC.xmap(
itemStack -> new InfusionParticleType(EndParticles.INFUSION, itemStack),
infusionParticleType -> infusionParticleType.itemStack);
public static final ParticleOptions.Deserializer<InfusionParticleType> PARAMETERS_FACTORY = new ParticleOptions.Deserializer<InfusionParticleType>() {
public InfusionParticleType fromCommand(ParticleType<InfusionParticleType> particleType, StringReader stringReader) throws CommandSyntaxException {
stringReader.expect(' ');
@ -35,8 +34,8 @@ public class InfusionParticleType extends ParticleType<InfusionParticleType> imp
}
};
private ParticleType<InfusionParticleType> type;
private ItemStack itemStack;
private final ParticleType<InfusionParticleType> type;
private final ItemStack itemStack;
public InfusionParticleType(ParticleType<InfusionParticleType> particleType, ItemStack stack) {
super(true, PARAMETERS_FACTORY);