Skip to content

Commit

Permalink
Add IFluidStack to IData expansion
Browse files Browse the repository at this point in the history
  • Loading branch information
Witixin1512 committed Jan 31, 2023
1 parent 4661605 commit d5cb865
Showing 1 changed file with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
import com.blamejared.crafttweaker.api.bracket.CommandStringDisplayable;
import com.blamejared.crafttweaker.api.data.MapData;
import com.blamejared.crafttweaker.platform.Services;
import com.blamejared.crafttweaker.api.data.IData;
import com.blamejared.crafttweaker.api.data.IntData;
import com.blamejared.crafttweaker.api.data.MapData;
import com.blamejared.crafttweaker.natives.resource.ExpandResourceLocation;
import com.blamejared.crafttweaker_annotations.annotations.Document;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.material.Fluid;
Expand Down Expand Up @@ -177,4 +181,13 @@ default CTFluidIngredient asList(CTFluidIngredient other) {
return new CTFluidIngredient.CompoundFluidIngredient(elements);
}

@ZenCodeType.Method
@ZenCodeType.Caster(implicit = true)
default IData asIData() {
MapData data = new MapData();
data.put("fluid", ExpandResourceLocation.asData(this.getRegistryName()));
data.put("amount", new IntData(this.getAmount()));
if (this.getTag() != null) data.put("nbt", this.getTag());
return data;
}
}

0 comments on commit d5cb865

Please sign in to comment.