-
Notifications
You must be signed in to change notification settings - Fork 754
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to mantle fluid transfer util
- Loading branch information
1 parent
0a3f650
commit 2407467
Showing
33 changed files
with
78 additions
and
705 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
...g/fluid_transfer/beetroot_soup_empty.json → ...e/fluid_transfer/beetroot_soup_empty.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:empty_item", | ||
"type": "mantle:empty_item", | ||
"input": { | ||
"item": "minecraft:beetroot_soup" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...ng/fluid_transfer/beetroot_soup_fill.json → ...le/fluid_transfer/beetroot_soup_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"item": "minecraft:bowl" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...ng/fluid_transfer/honey_bottle_empty.json → ...le/fluid_transfer/honey_bottle_empty.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:empty_item", | ||
"type": "mantle:empty_item", | ||
"input": { | ||
"item": "minecraft:honey_bottle" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...ing/fluid_transfer/honey_bottle_fill.json → ...tle/fluid_transfer/honey_bottle_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"item": "minecraft:glass_bottle" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...g/fluid_transfer/mushroom_stew_empty.json → ...e/fluid_transfer/mushroom_stew_empty.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:empty_item", | ||
"type": "mantle:empty_item", | ||
"input": { | ||
"item": "minecraft:mushroom_stew" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...ng/fluid_transfer/mushroom_stew_fill.json → ...le/fluid_transfer/mushroom_stew_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"item": "minecraft:bowl" | ||
}, | ||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...tinkering/fluid_transfer/potion_fill.json → ...ct/mantle/fluid_transfer/potion_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_nbt", | ||
"type": "mantle:fill_nbt", | ||
"input": { | ||
"item": "minecraft:glass_bottle" | ||
}, | ||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...fluid_transfer/potion_lingering_fill.json → ...fluid_transfer/potion_lingering_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_nbt", | ||
"type": "mantle:fill_nbt", | ||
"input": { | ||
"tag": "forge:bottles/lingering" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...luid_transfer/potion_lingering_water.json → ...luid_transfer/potion_lingering_water.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"tag": "forge:bottles/lingering" | ||
}, | ||
|
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...ng/fluid_transfer/potion_splash_fill.json → ...le/fluid_transfer/potion_splash_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_nbt", | ||
"type": "mantle:fill_nbt", | ||
"input": { | ||
"tag": "forge:bottles/splash" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...g/fluid_transfer/potion_splash_water.json → ...e/fluid_transfer/potion_splash_water.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"tag": "forge:bottles/splash" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...inkering/fluid_transfer/potion_water.json → ...t/mantle/fluid_transfer/potion_water.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"item": "minecraft:glass_bottle" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...ing/fluid_transfer/rabbit_stew_empty.json → ...tle/fluid_transfer/rabbit_stew_empty.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:empty_item", | ||
"type": "mantle:empty_item", | ||
"input": { | ||
"item": "minecraft:rabbit_stew" | ||
}, | ||
|
2 changes: 1 addition & 1 deletion
2
...ring/fluid_transfer/rabbit_stew_fill.json → ...ntle/fluid_transfer/rabbit_stew_fill.json
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"type": "tconstruct:fill_item", | ||
"type": "mantle:fill_item", | ||
"input": { | ||
"item": "minecraft:bowl" | ||
}, | ||
|
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
66 changes: 4 additions & 62 deletions
66
...limeknights/tconstruct/library/data/tinkering/AbstractFluidContainerTransferProvider.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 |
---|---|---|
@@ -1,69 +1,11 @@ | ||
package slimeknights.tconstruct.library.data.tinkering; | ||
|
||
import net.minecraft.data.DataGenerator; | ||
import net.minecraft.data.HashCache; | ||
import net.minecraft.resources.ResourceLocation; | ||
import net.minecraft.server.packs.PackType; | ||
import net.minecraft.tags.TagKey; | ||
import net.minecraft.world.item.crafting.Ingredient; | ||
import net.minecraft.world.level.ItemLike; | ||
import net.minecraft.world.level.material.Fluid; | ||
import net.minecraftforge.fluids.FluidStack; | ||
import slimeknights.mantle.data.GenericDataProvider; | ||
import slimeknights.mantle.recipe.helper.ItemOutput; | ||
import slimeknights.mantle.recipe.ingredient.FluidIngredient; | ||
import slimeknights.tconstruct.library.fluid.transfer.EmptyFluidContainerTransfer; | ||
import slimeknights.tconstruct.library.fluid.transfer.EmptyFluidWithNBTTransfer; | ||
import slimeknights.tconstruct.library.fluid.transfer.FillFluidContainerTransfer; | ||
import slimeknights.tconstruct.library.fluid.transfer.FillFluidWithNBTTransfer; | ||
import slimeknights.tconstruct.library.fluid.transfer.FluidContainerTransferManager; | ||
import slimeknights.tconstruct.library.fluid.transfer.IFluidContainerTransfer; | ||
|
||
import java.io.IOException; | ||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
/** Datagen for fluid transfer logic */ | ||
public abstract class AbstractFluidContainerTransferProvider extends GenericDataProvider { | ||
private final Map<ResourceLocation,IFluidContainerTransfer> allTransfers = new HashMap<>(); | ||
private final String modId; | ||
|
||
/** @deprecated use {@link slimeknights.mantle.fluid.transfer.AbstractFluidContainerTransferProvider} */ | ||
@Deprecated | ||
public abstract class AbstractFluidContainerTransferProvider extends slimeknights.mantle.fluid.transfer.AbstractFluidContainerTransferProvider { | ||
public AbstractFluidContainerTransferProvider(DataGenerator generator, String modId) { | ||
super(generator, PackType.SERVER_DATA, FluidContainerTransferManager.FOLDER, FluidContainerTransferManager.GSON); | ||
this.modId = modId; | ||
} | ||
|
||
/** Function to add all relevant transfers */ | ||
protected abstract void addTransfers(); | ||
|
||
/** Adds a transfer to be saved */ | ||
protected void addTransfer(ResourceLocation id, IFluidContainerTransfer transfer) { | ||
IFluidContainerTransfer previous = allTransfers.putIfAbsent(id, transfer); | ||
if (previous != null) { | ||
throw new IllegalArgumentException("Duplicate fluid container transfer " + id); | ||
} | ||
} | ||
|
||
/** Adds a transfer to be saved */ | ||
protected void addTransfer(String name, IFluidContainerTransfer transfer) { | ||
addTransfer(new ResourceLocation(modId, name), transfer); | ||
} | ||
|
||
/** Adds generic fill and empty for a container */ | ||
protected void addFillEmpty(String prefix, ItemLike item, ItemLike container, Fluid fluid, TagKey<Fluid> tag, int amount) { | ||
addTransfer(prefix + "empty", new EmptyFluidContainerTransfer(Ingredient.of(item), ItemOutput.fromItem(container), new FluidStack(fluid, amount))); | ||
addTransfer(prefix + "fill", new FillFluidContainerTransfer(Ingredient.of(container), ItemOutput.fromItem(item), FluidIngredient.of(tag, amount))); | ||
} | ||
|
||
/** Adds generic fill and empty for a container */ | ||
protected void addFillEmptyNBT(String prefix, ItemLike item, ItemLike container, Fluid fluid, TagKey<Fluid> tag, int amount) { | ||
addTransfer(prefix + "empty", new EmptyFluidWithNBTTransfer(Ingredient.of(item), ItemOutput.fromItem(container), new FluidStack(fluid, amount))); | ||
addTransfer(prefix + "fill", new FillFluidWithNBTTransfer(Ingredient.of(container), ItemOutput.fromItem(item), FluidIngredient.of(tag, amount))); | ||
} | ||
|
||
@Override | ||
public void run(HashCache cache) throws IOException { | ||
addTransfers(); | ||
allTransfers.forEach((id, data) -> saveThing(cache, id, data)); | ||
super(generator, modId); | ||
} | ||
} |
Oops, something went wrong.