Typo in crystallized.

Phase 1 working to oil generator.
This commit is contained in:
Flanks255 2022-04-01 21:50:39 -05:00
parent db00cb34d4
commit ff27e16bc1
19 changed files with 319 additions and 73 deletions

View file

@ -806,6 +806,10 @@ ec31df01057ad65de89068b01f96b3fb9f837bb4 data/actuallyadditions/recipes/lens.jso
634680e59ff81f293e3c44fd871e84fca96336ea data/actuallyadditions/recipes/lens_of_disenchanting.json 634680e59ff81f293e3c44fd871e84fca96336ea data/actuallyadditions/recipes/lens_of_disenchanting.json
9a958fc55ca0f759841f9813a8449639e175bbcc data/actuallyadditions/recipes/lens_of_the_killer.json 9a958fc55ca0f759841f9813a8449639e175bbcc data/actuallyadditions/recipes/lens_of_the_killer.json
1d560167a16962d870f0a4bf0cf9e74ac1431b3c data/actuallyadditions/recipes/lens_of_the_miner.json 1d560167a16962d870f0a4bf0cf9e74ac1431b3c data/actuallyadditions/recipes/lens_of_the_miner.json
701af1122ed158e5d162815a9f744169031698f4 data/actuallyadditions/recipes/liquid_fuel/canola_oil.json
0c908206a367aa9c04f751d1f69aa50d6d09ce3a data/actuallyadditions/recipes/liquid_fuel/crystallized_canola_oil.json
901f642d13b3768f2a00fbbdd3482c7b4866867f data/actuallyadditions/recipes/liquid_fuel/empowered_canola_oil.json
cce14618f9e39666e2858bf09c3cc7197e758b1c data/actuallyadditions/recipes/liquid_fuel/refined_canola_oil.json
7821b149dc37caa85b587a0276307f1b5cefaa03 data/actuallyadditions/recipes/netherite_aiot.json 7821b149dc37caa85b587a0276307f1b5cefaa03 data/actuallyadditions/recipes/netherite_aiot.json
2e2b1a33e5ecfb72a818d2e4ba8fe083f49b041c data/actuallyadditions/recipes/palis_aiot.json 2e2b1a33e5ecfb72a818d2e4ba8fe083f49b041c data/actuallyadditions/recipes/palis_aiot.json
21106732cd37767564077f5f0d0de9cc651ada83 data/actuallyadditions/recipes/palis_axe.json 21106732cd37767564077f5f0d0de9cc651ada83 data/actuallyadditions/recipes/palis_axe.json

View file

@ -0,0 +1,11 @@
{
"type": "actuallyadditions:liquid_fuel",
"ingredient": {
"fluid": "actuallyadditions:canola_oil",
"amount": 50
},
"result": {
"total_energy": 4000,
"burn_time": 100
}
}

View file

@ -0,0 +1,11 @@
{
"type": "actuallyadditions:liquid_fuel",
"ingredient": {
"fluid": "actuallyadditions:crystallized_oil",
"amount": 50
},
"result": {
"total_energy": 28000,
"burn_time": 280
}
}

View file

@ -0,0 +1,11 @@
{
"type": "actuallyadditions:liquid_fuel",
"ingredient": {
"fluid": "actuallyadditions:empowered_oil",
"amount": 50
},
"result": {
"total_energy": 48000,
"burn_time": 400
}
}

View file

@ -0,0 +1,11 @@
{
"type": "actuallyadditions:liquid_fuel",
"ingredient": {
"fluid": "actuallyadditions:refined_canola_oil",
"amount": 50
},
"result": {
"total_energy": 9600,
"burn_time": 120
}
}

View file

@ -46,6 +46,7 @@ public final class ActuallyAdditionsAPI {
public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>(); public static final Map<Item, IColorLensChanger> RECONSTRUCTOR_LENS_COLOR_CHANGERS = new HashMap<>();
public static final List<SolidFuelRecipe> SOLID_FUEL_RECIPES = new ArrayList<>(); public static final List<SolidFuelRecipe> SOLID_FUEL_RECIPES = new ArrayList<>();
public static final List<LiquidFuelRecipe> LIQUID_FUEL_RECIPES = new ArrayList<>();
public static final List<PressingRecipe> PRESSING_RECIPES = new ArrayList<>(); public static final List<PressingRecipe> PRESSING_RECIPES = new ArrayList<>();
public static final List<FermentingRecipe> FERMENTING_RECIPES = new ArrayList<>(); public static final List<FermentingRecipe> FERMENTING_RECIPES = new ArrayList<>();
public static final List<LaserRecipe> CONVERSION_LASER_RECIPES = new ArrayList<>(); public static final List<LaserRecipe> CONVERSION_LASER_RECIPES = new ArrayList<>();

View file

@ -36,7 +36,7 @@ public class ActuallyAdditionsData {
generator.addProvider(new LaserRecipeGenerator(generator)); generator.addProvider(new LaserRecipeGenerator(generator));
generator.addProvider(new EmpoweringRecipeGenerator(generator)); generator.addProvider(new EmpoweringRecipeGenerator(generator));
generator.addProvider(new CrushingRecipeGenerator(generator)); generator.addProvider(new CrushingRecipeGenerator(generator));
generator.addProvider(new SolidFuelGenerator(generator)); generator.addProvider(new FuelRecipeGenerator(generator));
generator.addProvider(new MiscMachineRecipeGenerator(generator)); generator.addProvider(new MiscMachineRecipeGenerator(generator));
} }
} }

View file

@ -0,0 +1,67 @@
package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.LiquidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidStack;
import javax.annotation.Nonnull;
import java.nio.file.Path;
import java.util.function.Consumer;
public class FuelRecipeGenerator extends RecipeProvider {
public FuelRecipeGenerator(DataGenerator pGenerator) {
super(pGenerator);
}
@Override
protected void saveAdvancement(@Nonnull DirectoryCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) {
//Nah
}
@Override
protected void buildShapelessRecipes(@Nonnull Consumer<IFinishedRecipe> consumer) {
addSolid(consumer, "coal", Items.COAL, 32000, 1600);
addSolid(consumer, "stick", Items.STICK, 2000, 100);
addSolid(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
addSolid(consumer, "charcoal", Items.CHARCOAL, 32000, 1600);
addSolid(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000);
addSolid(consumer, "charcoal-block", ActuallyBlocks.CHARCOAL_BLOCK.getItem(), 320000, 16000);
addSolid(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000);
consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/canola_oil"),
new FluidStack(InitFluids.CANOLA_OIL.get(), 50), 4000, 100));
consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/refined_canola_oil"),
new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 50), 9600, 120));
consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/crystallized_canola_oil"),
new FluidStack(InitFluids.CRYSTALLIZED_OIL.get(), 50), 28000, 280));
consumer.accept(new LiquidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "liquid_fuel/empowered_canola_oil"),
new FluidStack(InitFluids.EMPOWERED_OIL.get(), 50), 48000, 400));
}
private void addSolid(Consumer<IFinishedRecipe> consumer, String name, Item item, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime));
}
private void addSolid(Consumer<IFinishedRecipe> consumer, String name, Ingredient item, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime));
}
private void addSolid(Consumer<IFinishedRecipe> consumer, String name, ITag<Item> tag, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime));
}
}

View file

@ -9,7 +9,6 @@ import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.WallBlock; import net.minecraft.block.WallBlock;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.generators.ItemModelProvider; import net.minecraftforge.client.model.generators.ItemModelProvider;
@ -44,7 +43,7 @@ public class ItemModelGenerator extends ItemModelProvider {
Set<Block> ignoreList = ImmutableSet.of( Set<Block> ignoreList = ImmutableSet.of(
InitFluids.CANOLA_OIL.getBlock(), InitFluids.CANOLA_OIL.getBlock(),
InitFluids.REFINED_CANOLA_OIL.getBlock(), InitFluids.REFINED_CANOLA_OIL.getBlock(),
InitFluids.CRYSTALIZED_OIL.getBlock(), InitFluids.CRYSTALLIZED_OIL.getBlock(),
InitFluids.EMPOWERED_OIL.getBlock(), InitFluids.EMPOWERED_OIL.getBlock(),
ActuallyBlocks.CANOLA.get(), ActuallyBlocks.CANOLA.get(),
ActuallyBlocks.RICE.get(), ActuallyBlocks.RICE.get(),
@ -57,7 +56,7 @@ public class ItemModelGenerator extends ItemModelProvider {
generateBucket(InitFluids.CANOLA_OIL); generateBucket(InitFluids.CANOLA_OIL);
generateBucket(InitFluids.REFINED_CANOLA_OIL); generateBucket(InitFluids.REFINED_CANOLA_OIL);
generateBucket(InitFluids.CRYSTALIZED_OIL); generateBucket(InitFluids.CRYSTALLIZED_OIL);
generateBucket(InitFluids.EMPOWERED_OIL); generateBucket(InitFluids.EMPOWERED_OIL);
} }

View file

@ -13,16 +13,11 @@ import net.minecraft.block.CropsBlock;
import net.minecraft.data.DataGenerator; import net.minecraft.data.DataGenerator;
import net.minecraft.data.LootTableProvider; import net.minecraft.data.LootTableProvider;
import net.minecraft.data.loot.BlockLootTables; import net.minecraft.data.loot.BlockLootTables;
import net.minecraft.enchantment.Enchantments;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.Items; import net.minecraft.item.Items;
import net.minecraft.loot.*; import net.minecraft.loot.*;
import net.minecraft.loot.conditions.BlockStateProperty; import net.minecraft.loot.conditions.BlockStateProperty;
import net.minecraft.loot.functions.ApplyBonus;
import net.minecraft.loot.functions.SetCount;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.RegistryObject;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
@ -216,7 +211,7 @@ public class LootTableGenerator extends LootTableProvider {
final Set<Block> ignoreForNow = ImmutableSet.of( final Set<Block> ignoreForNow = ImmutableSet.of(
InitFluids.CANOLA_OIL.getBlock(), InitFluids.CANOLA_OIL.getBlock(),
InitFluids.REFINED_CANOLA_OIL.getBlock(), InitFluids.REFINED_CANOLA_OIL.getBlock(),
InitFluids.CRYSTALIZED_OIL.getBlock(), InitFluids.CRYSTALLIZED_OIL.getBlock(),
InitFluids.EMPOWERED_OIL.getBlock() InitFluids.EMPOWERED_OIL.getBlock()
); );

View file

@ -1,54 +0,0 @@
package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.api.ActuallyTags;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import de.ellpeck.actuallyadditions.mod.items.base.ActuallyItem;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tags.ITag;
import net.minecraft.util.ResourceLocation;
import javax.annotation.Nonnull;
import java.nio.file.Path;
import java.util.function.Consumer;
public class SolidFuelGenerator extends RecipeProvider {
public SolidFuelGenerator(DataGenerator pGenerator) {
super(pGenerator);
}
@Override
protected void saveAdvancement(@Nonnull DirectoryCache pCache, @Nonnull JsonObject pAdvancementJson, @Nonnull Path pPath) {
//Nah
}
@Override
protected void buildShapelessRecipes(@Nonnull Consumer<IFinishedRecipe> consumer) {
addFuel(consumer, "coal", Items.COAL, 32000, 1600);
addFuel(consumer, "stick", Items.STICK, 2000, 100);
addFuel(consumer, "tiny-coal", ActuallyTags.Items.TINY_COALS, 4000, 200);
addFuel(consumer, "charcoal", Items.CHARCOAL, 32000, 1600);
addFuel(consumer, "coal-block", Items.COAL_BLOCK, 320000, 16000);
addFuel(consumer, "charcoal-block", ActuallyBlocks.CHARCOAL_BLOCK.getItem(), 320000, 16000);
addFuel(consumer, "lava", Items.LAVA_BUCKET, 400000, 20000);
}
private void addFuel(Consumer<IFinishedRecipe> consumer, String name, Item item, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(item), energy, burnTime));
}
private void addFuel(Consumer<IFinishedRecipe> consumer, String name, Ingredient item, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), item, energy, burnTime));
}
private void addFuel(Consumer<IFinishedRecipe> consumer, String name, ITag<Item> tag, int energy, int burnTime) {
consumer.accept(new SolidFuelRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "solid_fuel/"+name), Ingredient.of(tag), energy, burnTime));
}
}

View file

@ -75,8 +75,8 @@ public class ActuallyAdditionsClient {
RenderTypeLookup.setRenderLayer(InitFluids.CANOLA_OIL.getFlowing(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.CANOLA_OIL.getFlowing(), RenderType.translucent());
RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.get(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.get(), RenderType.translucent());
RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.getFlowing(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.REFINED_CANOLA_OIL.getFlowing(), RenderType.translucent());
RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALIZED_OIL.get(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.get(), RenderType.translucent());
RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALIZED_OIL.getFlowing(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.CRYSTALLIZED_OIL.getFlowing(), RenderType.translucent());
RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.get(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.get(), RenderType.translucent());
RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.getFlowing(), RenderType.translucent()); RenderTypeLookup.setRenderLayer(InitFluids.EMPOWERED_OIL.getFlowing(), RenderType.translucent());

View file

@ -20,6 +20,7 @@ public class ActuallyRecipes {
public static final RegistryObject<IRecipeSerializer<?>> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> EMPOWERING_RECIPE = SERIALIZERS.register(EmpowererRecipe.NAME, EmpowererRecipe.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> CRUSHING_RECIPE = SERIALIZERS.register(CrushingRecipe.NAME, CrushingRecipe.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> LIQUID_FUEL_RECIPE = SERIALIZERS.register(LiquidFuelRecipe.NAME, LiquidFuelRecipe.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> FERMENTING_RECIPE = SERIALIZERS.register(FermentingRecipe.NAME, FermentingRecipe.Serializer::new);
@ -30,7 +31,7 @@ public class ActuallyRecipes {
public static final IRecipeType<EmpowererRecipe> EMPOWERING = IRecipeType.register(ActuallyAdditions.MODID + ":empower"); public static final IRecipeType<EmpowererRecipe> EMPOWERING = IRecipeType.register(ActuallyAdditions.MODID + ":empower");
public static final IRecipeType<CrushingRecipe> CRUSHING = IRecipeType.register(ActuallyAdditions.MODID + ":crushing"); public static final IRecipeType<CrushingRecipe> CRUSHING = IRecipeType.register(ActuallyAdditions.MODID + ":crushing");
public static final IRecipeType<SolidFuelRecipe> SOLID_FUEL = IRecipeType.register(ActuallyAdditions.MODID + ":solid_fuel"); public static final IRecipeType<SolidFuelRecipe> SOLID_FUEL = IRecipeType.register(ActuallyAdditions.MODID + ":solid_fuel");
//public static final IRecipeType<LiquidFuelRecipe> LIQUIDFUEL = IRecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel"); public static final IRecipeType<LiquidFuelRecipe> LIQUID_FUEL = IRecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel");
public static final IRecipeType<PressingRecipe> PRESSING = IRecipeType.register(ActuallyAdditions.MODID + ":pressing"); public static final IRecipeType<PressingRecipe> PRESSING = IRecipeType.register(ActuallyAdditions.MODID + ":pressing");
public static final IRecipeType<FermentingRecipe> FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting"); public static final IRecipeType<FermentingRecipe> FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting");
} }

View file

@ -80,6 +80,7 @@ public class FermentingRecipe implements IRecipe<IInventory> {
return false; return false;
} }
@Nonnull
@Override @Override
public ItemStack assemble(IInventory pInv) { public ItemStack assemble(IInventory pInv) {
return ItemStack.EMPTY; return ItemStack.EMPTY;
@ -90,21 +91,25 @@ public class FermentingRecipe implements IRecipe<IInventory> {
return false; return false;
} }
@Nonnull
@Override @Override
public ItemStack getResultItem() { public ItemStack getResultItem() {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
@Nonnull
@Override @Override
public ResourceLocation getId() { public ResourceLocation getId() {
return ID; return ID;
} }
@Nonnull
@Override @Override
public IRecipeSerializer<?> getSerializer() { public IRecipeSerializer<?> getSerializer() {
return ActuallyRecipes.FERMENTING_RECIPE.get(); return ActuallyRecipes.FERMENTING_RECIPE.get();
} }
@Nonnull
@Override @Override
public IRecipeType<?> getType() { public IRecipeType<?> getType() {
return ActuallyRecipes.Types.FERMENTING; return ActuallyRecipes.Types.FERMENTING;

View file

@ -36,7 +36,7 @@ public final class InitCrafting {
int[] time = ConfigIntListValues.OIL_TIME.getValue(); int[] time = ConfigIntListValues.OIL_TIME.getValue();
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.CANOLA_OIL.getName(), power[0], time[0]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.CANOLA_OIL.getName(), power[0], time[0]);
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.REFINED_CANOLA_OIL.getName(), power[1], time[1]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.REFINED_CANOLA_OIL.getName(), power[1], time[1]);
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.CRYSTALIZED_OIL.getName(), power[2], time[2]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.CRYSTALLIZED_OIL.getName(), power[2], time[2]);
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.EMPOWERED_OIL.getName(), power[3], time[3]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.EMPOWERED_OIL.getName(), power[3], time[3]);
ActuallyAdditionsAPI.addFarmerBehavior(new DefaultFarmerBehavior()); ActuallyAdditionsAPI.addFarmerBehavior(new DefaultFarmerBehavior());

View file

@ -0,0 +1,183 @@
package de.ellpeck.actuallyadditions.mod.crafting;
import com.google.gson.JsonObject;
import com.google.gson.JsonParseException;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.fluid.Fluid;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.item.crafting.IRecipeType;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class LiquidFuelRecipe implements IRecipe<IInventory> {
public static String NAME = "liquid_fuel";
private FluidStack fuel;
private int burnTime;
private int totalEnergy;
private ResourceLocation id;
public LiquidFuelRecipe(ResourceLocation id, FluidStack fuel, int totalEnergy, int burnTime) {
this.fuel = fuel;
this.burnTime = burnTime;
this.totalEnergy = totalEnergy;
this.id = id;
}
public int getBurnTime() {
return burnTime;
}
public int getTotalEnergy() {
return totalEnergy;
}
@Override
public boolean matches(@Nonnull IInventory pInv,@Nonnull World pLevel) {
return false;
}
public boolean matches(FluidStack stack) {
return this.fuel.isFluidEqual(stack);
}
@Nonnull
@Override
public ItemStack assemble(@Nonnull IInventory pInv) {
return ItemStack.EMPTY;
}
@Override
public boolean canCraftInDimensions(int pWidth, int pHeight) {
return false;
}
@Nonnull
@Override
public ItemStack getResultItem() {
return ItemStack.EMPTY;
}
@Nonnull
@Override
public ResourceLocation getId() {
return id;
}
@Nonnull
@Override
public IRecipeSerializer<?> getSerializer() {
return ActuallyRecipes.LIQUID_FUEL_RECIPE.get();
}
@Nonnull
@Override
public IRecipeType<?> getType() {
return ActuallyRecipes.Types.LIQUID_FUEL;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<LiquidFuelRecipe> {
@Nonnull
@Override
public LiquidFuelRecipe fromJson(@Nonnull ResourceLocation pId, JsonObject pJson) {
JsonObject ingredient = pJson.getAsJsonObject("ingredient");
ResourceLocation fluidRes = new ResourceLocation(JSONUtils.getAsString(ingredient, "fluid"));
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
if (fluid == null)
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
int inputAmount = JSONUtils.getAsInt(ingredient, "amount", 50);
FluidStack input = new FluidStack(fluid, inputAmount);
JsonObject result = pJson.getAsJsonObject("result");
int totalEnergy = result.get("total_energy").getAsInt();
int burnTime = result.get("burn_time").getAsInt();
return new LiquidFuelRecipe(pId, input, totalEnergy, burnTime);
}
@Override
public LiquidFuelRecipe fromNetwork(@Nonnull ResourceLocation pId, @Nonnull PacketBuffer pBuffer) {
ResourceLocation inputRes = new ResourceLocation(pBuffer.readUtf());
int inputAmount = pBuffer.readInt();
Fluid inputFluid = ForgeRegistries.FLUIDS.getValue(inputRes);
if(inputFluid == null)
throw new JsonParseException("Unknown input fluid '" + inputRes + "'");
FluidStack input = new FluidStack(inputFluid, inputAmount);
int totalEnergy = pBuffer.readInt();
int burnTime = pBuffer.readInt();
return new LiquidFuelRecipe(pId, input, totalEnergy, burnTime);
}
@Override
public void toNetwork(@Nonnull PacketBuffer pBuffer, LiquidFuelRecipe pRecipe) {
pBuffer.writeUtf(pRecipe.fuel.getFluid().getRegistryName().toString());
pBuffer.writeInt(pRecipe.fuel.getAmount());
pBuffer.writeInt(pRecipe.totalEnergy);
pBuffer.writeInt(pRecipe.burnTime);
}
}
public static class FinishedRecipe implements IFinishedRecipe {
private FluidStack fuel;
private int burnTime;
private int totalEnergy;
private ResourceLocation id;
public FinishedRecipe(ResourceLocation id, FluidStack fuel, int totalEnergy, int burnTime) {
this.fuel = fuel;
this.burnTime = burnTime;
this.totalEnergy = totalEnergy;
this.id = id;
}
@Override
public void serializeRecipeData(JsonObject pJson) {
JsonObject ingredient = new JsonObject();
ingredient.addProperty("fluid", fuel.getFluid().getRegistryName().toString());
ingredient.addProperty("amount", fuel.getAmount());
JsonObject result = new JsonObject();
result.addProperty("total_energy", totalEnergy);
result.addProperty("burn_time", burnTime);
pJson.add("ingredient", ingredient);
pJson.add("result", result);
}
@Nonnull
@Override
public ResourceLocation getId() {
return id;
}
@Nonnull
@Override
public IRecipeSerializer<?> getType() {
return ActuallyRecipes.LIQUID_FUEL_RECIPE.get();
}
@Nullable
@Override
public JsonObject serializeAdvancement() {
return null;
}
@Nullable
@Override
public ResourceLocation getAdvancementId() {
return null;
}
}
}

View file

@ -23,7 +23,7 @@ public final class InitFluids {
public static final FluidAA CANOLA_OIL = new FluidAA("canola_oil", "fluid/canola_oil"); public static final FluidAA CANOLA_OIL = new FluidAA("canola_oil", "fluid/canola_oil");
public static final FluidAA REFINED_CANOLA_OIL = new FluidAA("refined_canola_oil", "fluid/refined_canola_oil"); public static final FluidAA REFINED_CANOLA_OIL = new FluidAA("refined_canola_oil", "fluid/refined_canola_oil");
public static final FluidAA CRYSTALIZED_OIL = new FluidAA("crystallized_oil", "fluid/crystallized_oil"); public static final FluidAA CRYSTALLIZED_OIL = new FluidAA("crystallized_oil", "fluid/crystallized_oil");
public static final FluidAA EMPOWERED_OIL = new FluidAA("empowered_oil", "fluid/empowered_oil"); public static final FluidAA EMPOWERED_OIL = new FluidAA("empowered_oil", "fluid/empowered_oil");

View file

@ -7,10 +7,8 @@ import net.minecraft.block.BlockState;
import net.minecraft.block.FlowingFluidBlock; import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.IFluidBlock;
public class CanolaSeed extends ItemBase { public class CanolaSeed extends ItemBase {
public boolean empowered; public boolean empowered;
@ -34,12 +32,12 @@ public class CanolaSeed extends ItemBase {
if (block instanceof FlowingFluidBlock && state.getFluidState().isSource()) { if (block instanceof FlowingFluidBlock && state.getFluidState().isSource()) {
Fluid fluid = ((FlowingFluidBlock) block).getFluid(); Fluid fluid = ((FlowingFluidBlock) block).getFluid();
if (fluid != null && fluid == (empowered if (fluid != null && fluid == (empowered
? InitFluids.CRYSTALIZED_OIL.get() ? InitFluids.CRYSTALLIZED_OIL.get()
: InitFluids.REFINED_CANOLA_OIL.get())) { : InitFluids.REFINED_CANOLA_OIL.get())) {
entity.kill(); entity.kill();
entity.level.setBlockAndUpdate(pos, (empowered entity.level.setBlockAndUpdate(pos, (empowered
? InitFluids.EMPOWERED_OIL.getBlock() ? InitFluids.EMPOWERED_OIL.getBlock()
: InitFluids.CRYSTALIZED_OIL.getBlock()).defaultBlockState()); : InitFluids.CRYSTALLIZED_OIL.getBlock()).defaultBlockState());
} }
} }
} }

View file

@ -27,6 +27,9 @@ public class ResourceReloader implements IResourceManagerReloadListener {
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear(); ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear();
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL)); ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL));
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.clear();
ActuallyAdditionsAPI.LIQUID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.LIQUID_FUEL));
ActuallyAdditionsAPI.PRESSING_RECIPES.clear(); ActuallyAdditionsAPI.PRESSING_RECIPES.clear();
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING)); ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING));