Compare commits

...

2 commits

Author SHA1 Message Date
Flanks255
9b11bf3245 Crushy McCrushRecipeFace 2021-10-24 11:49:48 -05:00
Flanks255
93fdf5a674 Some fluid stuff maybe... 2021-10-24 11:03:33 -05:00
14 changed files with 280 additions and 124 deletions

View file

@ -19,6 +19,7 @@ import de.ellpeck.actuallyadditions.api.laser.ILaserRelayConnectionHandler;
import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.api.lens.Lens;
import de.ellpeck.actuallyadditions.api.lens.LensConversion; import de.ellpeck.actuallyadditions.api.lens.LensConversion;
import de.ellpeck.actuallyadditions.api.recipe.*; import de.ellpeck.actuallyadditions.api.recipe.*;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe; import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
@ -38,7 +39,7 @@ public final class ActuallyAdditionsAPI {
public static final String API_ID = MOD_ID + "api"; public static final String API_ID = MOD_ID + "api";
public static final String API_VERSION = "34"; public static final String API_VERSION = "34";
public static final List<CrusherRecipe> CRUSHER_RECIPES = new ArrayList<>(); public static final List<CrushingRecipe> CRUSHER_RECIPES = new ArrayList<>();
public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>(); public static final List<BallOfFurReturn> BALL_OF_FUR_RETURN_ITEMS = new ArrayList<>();
// public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>(); // public static final List<TreasureChestLoot> TREASURE_CHEST_LOOT = new ArrayList<>();
public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>(); public static final List<LensConversionRecipe> RECONSTRUCTOR_LENS_CONVERSION_RECIPES = new ArrayList<>();
@ -133,7 +134,7 @@ public final class ActuallyAdditionsAPI {
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/ */
public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) { public static void addCrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
CRUSHER_RECIPES.add(new CrusherRecipe(Ingredient.of(input), outputOne, outputTwo.isEmpty() CRUSHER_RECIPES.add(new CrushingRecipe(Ingredient.of(input), outputOne, outputTwo.isEmpty()
? ItemStack.EMPTY ? ItemStack.EMPTY
: outputTwo, outputTwoChance)); : outputTwo, outputTwoChance));
} }
@ -147,7 +148,7 @@ public final class ActuallyAdditionsAPI {
* @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time) * @param outputTwoChance The chance of the second output (0 won't occur at all, 100 will all the time)
*/ */
public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) { public static void addCrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputTwoChance) {
CRUSHER_RECIPES.add(new CrusherRecipe(input, outputOne, outputTwo.isEmpty() CRUSHER_RECIPES.add(new CrushingRecipe(input, outputOne, outputTwo.isEmpty()
? ItemStack.EMPTY ? ItemStack.EMPTY
: outputTwo, outputTwoChance)); : outputTwo, outputTwoChance));
} }

View file

@ -1,55 +0,0 @@
/*
* This file ("CrusherRecipe.java") is part of the Actually Additions mod for Minecraft.
* It is created and owned by Ellpeck and distributed
* under the Actually Additions License to be found at
* http://ellpeck.de/actaddlicense
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
*
* © 2015-2017 Ellpeck
*/
package de.ellpeck.actuallyadditions.api.recipe;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.Ingredient;
public class CrusherRecipe {
protected Ingredient input;
protected ItemStack outputOne;
protected ItemStack outputTwo;
protected int outputChance;
@Deprecated
public CrusherRecipe(ItemStack input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
this(Ingredient.of(input), outputOne, outputTwo, outputChance);
}
public CrusherRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
this.input = input;
this.outputOne = outputOne;
this.outputTwo = outputTwo;
this.outputChance = outputChance;
}
public boolean matches(ItemStack stack) {
return this.input.test(stack);
}
public ItemStack getOutputOne() {
return this.outputOne;
}
public ItemStack getOutputTwo() {
return this.outputTwo;
}
public int getSecondChance() {
return this.outputChance;
}
public Ingredient getInput() {
return this.input;
}
}

View file

@ -32,6 +32,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));
} }
} }
} }

View file

@ -0,0 +1,25 @@
package de.ellpeck.actuallyadditions.data;
import com.google.gson.JsonObject;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IFinishedRecipe;
import net.minecraft.data.RecipeProvider;
import java.nio.file.Path;
import java.util.function.Consumer;
public class CrushingRecipeGenerator extends RecipeProvider {
public CrushingRecipeGenerator(DataGenerator p_i48262_1_) {
super(p_i48262_1_);
}
@Override
protected void saveAdvancement(DirectoryCache p_208310_1_, JsonObject p_208310_2_, Path p_208310_3_) {
}
@Override
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> p_200404_1_) {
}
}

View file

@ -93,6 +93,7 @@ public class ActuallyAdditions {
MinecraftForge.EVENT_BUS.register(new CommonEvents()); MinecraftForge.EVENT_BUS.register(new CommonEvents());
MinecraftForge.EVENT_BUS.register(new DungeonLoot()); MinecraftForge.EVENT_BUS.register(new DungeonLoot());
MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent); MinecraftForge.EVENT_BUS.addListener(ActuallyAdditions::reloadEvent);
InitFluids.init(eventBus);
eventBus.addListener(this::setup); eventBus.addListener(this::setup);
eventBus.addListener(this::clientSetup); eventBus.addListener(this::clientSetup);
@ -109,7 +110,6 @@ public class ActuallyAdditions {
commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities"); commonCapsLoaded = false; // Loader.isModLoaded("commoncapabilities");
InitFluids.init();
new UpdateChecker(); new UpdateChecker();
BannerHelper.init(); BannerHelper.init();
InitEntities.init(); // todo: [port] replace InitEntities.init(); // todo: [port] replace

View file

@ -11,9 +11,9 @@
package de.ellpeck.actuallyadditions.mod.booklet.page; package de.ellpeck.actuallyadditions.mod.booklet.page;
import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase; import de.ellpeck.actuallyadditions.api.booklet.internal.GuiBookletBase;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet; import de.ellpeck.actuallyadditions.mod.booklet.gui.GuiBooklet;
import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
@ -25,12 +25,12 @@ import java.util.List;
public class PageCrusherRecipe extends BookletPage { public class PageCrusherRecipe extends BookletPage {
private final CrusherRecipe recipe; private final CrushingRecipe recipe;
private int counter = 0; private int counter = 0;
private int rotate = 0; private int rotate = 0;
private final ItemStack[] stacks; private final ItemStack[] stacks;
public PageCrusherRecipe(int localizationKey, CrusherRecipe recipe) { public PageCrusherRecipe(int localizationKey, CrushingRecipe recipe) {
super(localizationKey); super(localizationKey);
this.recipe = recipe; this.recipe = recipe;
this.stacks = recipe.getInput().getItems(); this.stacks = recipe.getInput().getItems();

View file

@ -18,13 +18,14 @@ public class ActuallyRecipes {
public static final RegistryObject<IRecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> KEEP_DATA_SHAPED_RECIPE = SERIALIZERS.register(RecipeKeepDataShaped.NAME, RecipeKeepDataShaped.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new); public static final RegistryObject<IRecipeSerializer<?>> LASER_RECIPE = SERIALIZERS.register(LaserRecipe.NAME, LaserRecipe.Serializer::new);
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 class Types { public static class Types {
public static final IRecipeType<LaserRecipe> LASER = IRecipeType.register(ActuallyAdditions.MODID + ":laser"); public static final IRecipeType<LaserRecipe> LASER = IRecipeType.register(ActuallyAdditions.MODID + ":laser");
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 + ":crush"); public static final IRecipeType<CrushingRecipe> CRUSHING = IRecipeType.register(ActuallyAdditions.MODID + ":crushing");
//public static final IRecipeType<SolidFuelRecipe> SOLIDFUEL = IRecipeType.register(ActuallyAdditions.MODID + ":solid_fuel"); //public static final IRecipeType<SolidFuelRecipe> SOLIDFUEL = IRecipeType.register(ActuallyAdditions.MODID + ":solid_fuel");
//public static final IRecipeType<LiquidFuelRecipe> LIQUIDFUEL = IRecipeType.register(ActuallyAdditions.MODID + ":liquid_fuel"); //public static final IRecipeType<LiquidFuelRecipe> LIQUIDFUEL = 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");

View file

@ -0,0 +1,173 @@
package de.ellpeck.actuallyadditions.mod.crafting;
import com.google.gson.JsonObject;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import net.minecraft.data.IFinishedRecipe;
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.IItemProvider;
import net.minecraft.util.JSONUtils;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World;
import net.minecraftforge.registries.ForgeRegistryEntry;
import javax.annotation.Nullable;
public class CrushingRecipe implements IRecipe<IInventory> {
public static String NAME = "crushing";
private ResourceLocation id;
protected Ingredient input;
protected ItemStack outputOne;
protected ItemStack outputTwo;
protected int outputChance;
public CrushingRecipe(ResourceLocation id, Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
this.id = id;
this.input = input;
this.outputOne = outputOne;
this.outputTwo = outputTwo;
this.outputChance = outputChance;
}
public CrushingRecipe(Ingredient input, ItemStack outputOne, ItemStack outputTwo, int outputChance) {
this.id = new ResourceLocation(ActuallyAdditions.MODID, input.getItems()[0].getItem().getRegistryName().getPath() + "_crushing");
this.input = input;
this.outputOne = outputOne;
this.outputTwo = outputTwo;
this.outputChance = outputChance;
}
@Override
public boolean matches(IInventory pInv, World pLevel) {
return input.test(pInv.getItem(0));
}
@Override
public ItemStack assemble(IInventory pInv) {
return ItemStack.EMPTY;
}
@Override
public boolean canCraftInDimensions(int pWidth, int pHeight) {
return true;
}
@Override
public ItemStack getResultItem() {
return outputOne;
}
@Override
public ResourceLocation getId() {
return id;
}
@Override
public IRecipeSerializer<?> getSerializer() {
return ActuallyRecipes.CRUSHING_RECIPE.get();
}
@Override
public IRecipeType<?> getType() {
return ActuallyRecipes.Types.CRUSHING;
}
public ItemStack getOutputOne() {
return this.outputOne;
}
public ItemStack getOutputTwo() {
return this.outputTwo;
}
public int getSecondChance() {
return this.outputChance;
}
public Ingredient getInput() {
return this.input;
}
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<CrushingRecipe> {
@Override
public CrushingRecipe fromJson(ResourceLocation pRecipeId, JsonObject pJson) {
Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "input"));
ItemStack output1 = new ItemStack(JSONUtils.getAsItem(pJson, "output_one"));
ItemStack output2 = new ItemStack(JSONUtils.getAsItem(pJson, "output_two"));
int chance = JSONUtils.getAsInt(pJson, "second_chance");
return new CrushingRecipe(pRecipeId, ingredient, output1, output2, chance);
}
@Nullable
@Override
public CrushingRecipe fromNetwork(ResourceLocation pRecipeId, PacketBuffer pBuffer) {
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
ItemStack output1 = pBuffer.readItem();
ItemStack output2 = pBuffer.readItem();
int chance = pBuffer.readInt();
return new CrushingRecipe(pRecipeId, ingredient, output1, output2, chance);
}
@Override
public void toNetwork(PacketBuffer pBuffer, CrushingRecipe pRecipe) {
pRecipe.input.toNetwork(pBuffer);
pBuffer.writeItem(pRecipe.outputOne);
pBuffer.writeItem(pRecipe.outputTwo);
pBuffer.writeInt(pRecipe.outputChance);
}
}
public static class FinishedRecipe implements IFinishedRecipe {
private ResourceLocation id;
protected Ingredient input;
protected IItemProvider outputOne;
protected IItemProvider outputTwo;
protected int outputChance;
public FinishedRecipe(ResourceLocation id, Ingredient input, IItemProvider outputOne, IItemProvider outputTwo, int outputChance) {
this.id = id;
this.input = input;
this.outputOne = outputOne;
this.outputTwo = outputTwo;
this.outputChance = outputChance;
}
@Override
public void serializeRecipeData(JsonObject pJson) {
pJson.add("input", input.toJson());
pJson.addProperty("output_one", outputOne.asItem().getRegistryName().toString());
pJson.addProperty("output_two", outputTwo.asItem().getRegistryName().toString());
pJson.addProperty("second_chance", outputChance);
}
@Override
public ResourceLocation getId() {
return id;
}
@Override
public IRecipeSerializer<?> getType() {
return ActuallyRecipes.CRUSHING_RECIPE.get();
}
@Nullable
@Override
public JsonObject serializeAdvancement() {
return null;
}
@Nullable
@Override
public ResourceLocation getAdvancementId() {
return null;
}
}
}

View file

@ -35,10 +35,10 @@ public final class InitCrafting {
int[] power = ConfigIntListValues.OIL_POWER.getValue(); int[] power = ConfigIntListValues.OIL_POWER.getValue();
int[] time = ConfigIntListValues.OIL_TIME.getValue(); int[] time = ConfigIntListValues.OIL_TIME.getValue();
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.fluidCanolaOil.getName(), power[0], time[0]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.CANOLA_OIL.getName(), power[0], time[0]);
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.fluidRefinedCanolaOil.getName(), power[1], time[1]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.REFINED_CANOLA_OIL.getName(), power[1], time[1]);
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.fluidCrystalOil.getName(), power[2], time[2]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.CRYSTALIZED_OIL.getName(), power[2], time[2]);
ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.fluidEmpoweredOil.getName(), power[3], time[3]); ActuallyAdditionsAPI.addOilGenRecipe(InitFluids.EMPOWERED_OIL.getName(), power[3], time[3]);
ActuallyAdditionsAPI.addFarmerBehavior(new DefaultFarmerBehavior()); ActuallyAdditionsAPI.addFarmerBehavior(new DefaultFarmerBehavior());
ActuallyAdditionsAPI.addFarmerBehavior(new CactusFarmerBehavior()); ActuallyAdditionsAPI.addFarmerBehavior(new CactusFarmerBehavior());

View file

@ -11,17 +11,62 @@
package de.ellpeck.actuallyadditions.mod.fluids; package de.ellpeck.actuallyadditions.mod.fluids;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
import net.minecraft.block.AbstractBlock;
import net.minecraft.block.Block;
import net.minecraft.block.FlowingFluidBlock;
import net.minecraft.block.material.Material;
import net.minecraft.fluid.FlowingFluid;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.item.BucketItem;
import net.minecraft.item.Item;
import net.minecraft.item.Items;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.ForgeFlowingFluid;
import net.minecraftforge.fml.RegistryObject;
public class FluidAA extends Fluid { import java.util.function.Supplier;
public class FluidAA implements Supplier<Fluid> {
private String name;
private RegistryObject<ForgeFlowingFluid> source;
private RegistryObject<ForgeFlowingFluid> flowing;
private RegistryObject<FlowingFluidBlock> fluidBlock;
private RegistryObject<Item> bucket;
public String getName() {
return name;
}
public FluidAA(String fluidName, String textureName) { public FluidAA(String fluidName, String textureName) {
super(fluidName, new ResourceLocation(ActuallyAdditions.MODID, "blocks/" + textureName + "_still"), new ResourceLocation(ActuallyAdditions.MODID, "blocks/" + textureName + "_flowing")); name = fluidName;
ForgeFlowingFluid.Properties props = makeProperties(textureName, fluidBlock, source, flowing, bucket);
source = InitFluids.FLUIDS.register(name, () -> new ForgeFlowingFluid.Source(props));
flowing = InitFluids.FLUIDS.register(name + "_flowing", () -> new ForgeFlowingFluid.Flowing(props));
fluidBlock = ActuallyBlocks.BLOCKS.register(name, () -> new FlowingFluidBlock(source, AbstractBlock.Properties.of(Material.WATER)));
bucket = ActuallyItems.ITEMS.register(name + "_bucket", () -> new BucketItem(source.get(), new Item.Properties().craftRemainder(Items.BUCKET).tab(ActuallyAdditions.GROUP).stacksTo(1)));
}
public static ForgeFlowingFluid.Properties makeProperties(String texture, Supplier<FlowingFluidBlock> blockSupplier, Supplier<ForgeFlowingFluid> stillSupplier, Supplier<ForgeFlowingFluid> flowingSupplier, Supplier<Item> bucketSupplier) {
return new ForgeFlowingFluid.Properties(stillSupplier, flowingSupplier, FluidAttributes.builder(new ResourceLocation(ActuallyAdditions.MODID,texture), new ResourceLocation(ActuallyAdditions.MODID, texture))).bucket(bucketSupplier).block(blockSupplier);
} }
@Override @Override
public String getUnlocalizedName() { public Fluid get() {
return "fluid." + ActuallyAdditions.MODID + "." + this.unlocalizedName; return source.get();
}
public Block getBlock() {
return fluidBlock.get();
}
public Item getBucket() {
return bucket.get();
}
public FlowingFluid getFlowing() {
return flowing.get();
} }
} }

View file

@ -11,51 +11,24 @@
package de.ellpeck.actuallyadditions.mod.fluids; package de.ellpeck.actuallyadditions.mod.fluids;
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockFluidFlowing;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluid;
import net.minecraft.item.Rarity; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.fml.RegistryObject;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
import java.util.Locale;
public final class InitFluids { public final class InitFluids {
public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, ActuallyAdditions.MODID); public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(ForgeRegistries.FLUIDS, ActuallyAdditions.MODID);
public static final DeferredRegister<Block> FLUID_BLOCKS = DeferredRegister.create(ForgeRegistries.BLOCKS, ActuallyAdditions.MODID);
public static final RegistryObject<Fluid> fluidCanolaOil = FLUIDS.register("canolaoil", () -> registerFluid("canolaoil","block_canola_oil")); public static final FluidAA CANOLA_OIL = new FluidAA("canolaoil", "canolaoil");
public static final RegistryObject<Fluid> fluidRefinedCanolaOil = FLUIDS.register("refinedcanolaoil", () -> registerFluid("refinedcanolaoil","block_refined_canola_oil")); public static final FluidAA REFINED_CANOLA_OIL = new FluidAA("refinedcanolaoil", "refinedcanolaoil");
public static final RegistryObject<Fluid> fluidCrystalOil = FLUIDS.register("crystaloil", () -> registerFluid("crystaloil","block_crystal_oil")); public static final FluidAA CRYSTALIZED_OIL = new FluidAA("crystaloil", "crystaloil");
public static final RegistryObject<Fluid> fluidEmpoweredOil = FLUIDS.register("empoweredoil", () -> registerFluid("empoweredoil","block_empowered_oil")); public static final FluidAA EMPOWERED_OIL = new FluidAA("empoweredoil", "empoweredoil");
public static Block blockCanolaOil;
public static Block blockRefinedCanolaOil;
public static Block blockCrystalOil;
public static Block blockEmpoweredOil;
public static void init() { public static void init(IEventBus bus) {
//fluidCanolaOil = registerFluid("canolaoil", "block_canola_oil", Rarity.COMMON); FLUIDS.register(bus);
//fluidRefinedCanolaOil = registerFluid("refinedcanolaoil", "block_refined_canola_oil", Rarity.UNCOMMON); FLUID_BLOCKS.register(bus);
//fluidCrystalOil = registerFluid("crystaloil", "block_crystal_oil", Rarity.RARE);
//fluidEmpoweredOil = registerFluid("empoweredoil", "block_empowered_oil", Rarity.EPIC);
blockCanolaOil = registerFluidBlock(fluidCanolaOil.get(), Material.WATER, "block_canola_oil");
blockRefinedCanolaOil = registerFluidBlock(fluidRefinedCanolaOil.get(), Material.WATER, "block_refined_canola_oil");
blockCrystalOil = registerFluidBlock(fluidCrystalOil.get(), Material.WATER, "block_crystal_oil");
blockEmpoweredOil = registerFluidBlock(fluidEmpoweredOil.get(), Material.WATER, "block_empowered_oil");
}
private static Fluid registerFluid(String fluidName, String fluidTextureName) {
Fluid fluid = new FluidAA(fluidName.toLowerCase(Locale.ROOT), fluidTextureName);
// FluidRegistry.registerFluid(fluid);
// FluidRegistry.addBucketForFluid(fluid);
return fluid;
}
private static Block registerFluidBlock(Fluid fluid, Material material, String name) {
return new BlockFluidFlowing(fluid, material, name); //TODO ohhhh boy, all this fluid stuff needs to be redone.
} }
} }

View file

@ -37,8 +37,6 @@ import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityCanolaPress extends TileEntityInventoryBase implements INamedContainerProvider, ISharingFluidHandler { public class TileEntityCanolaPress extends TileEntityInventoryBase implements INamedContainerProvider, ISharingFluidHandler {
public static final int PRODUCE = 80; public static final int PRODUCE = 80;
@ -113,7 +111,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1)); this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1));
this.tank.fill(new FluidStack(InitFluids.fluidCanolaOil.get(), PRODUCE), IFluidHandler.FluidAction.EXECUTE); this.tank.fill(new FluidStack(InitFluids.CANOLA_OIL.get(), PRODUCE), IFluidHandler.FluidAction.EXECUTE);
this.setChanged(); this.setChanged();
} }
} }

View file

@ -10,9 +10,8 @@
package de.ellpeck.actuallyadditions.mod.tile; package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.recipe.CrusherRecipe;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.blocks.BlockPoweredFurnace; import de.ellpeck.actuallyadditions.mod.crafting.CrushingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder; import de.ellpeck.actuallyadditions.mod.inventory.ContainerGrinder;
import de.ellpeck.actuallyadditions.mod.misc.SoundHandler; import de.ellpeck.actuallyadditions.mod.misc.SoundHandler;
import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor; import de.ellpeck.actuallyadditions.mod.network.gui.IButtonReactor;
@ -20,7 +19,6 @@ import de.ellpeck.actuallyadditions.mod.recipe.CrusherRecipeRegistry;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover; import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
import de.ellpeck.actuallyadditions.mod.util.StackUtil; import de.ellpeck.actuallyadditions.mod.util.StackUtil;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
@ -189,7 +187,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) { public boolean canCrushOn(int theInput, int theFirstOutput, int theSecondOutput) {
if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) { if (StackUtil.isValid(this.inv.getStackInSlot(theInput))) {
CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); CrushingRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput));
if (recipe == null) { if (recipe == null) {
return false; return false;
} }
@ -219,7 +217,7 @@ public class TileEntityCrusher extends TileEntityInventoryBase implements IButto
} }
public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) { public void finishCrushing(int theInput, int theFirstOutput, int theSecondOutput) {
CrusherRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput)); CrushingRecipe recipe = CrusherRecipeRegistry.getRecipeFromInput(this.inv.getStackInSlot(theInput));
if (recipe == null) { if (recipe == null) {
return; return;
} }

View file

@ -13,7 +13,6 @@ package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks; import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids; import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel; import de.ellpeck.actuallyadditions.mod.inventory.ContainerFermentingBarrel;
import de.ellpeck.actuallyadditions.mod.util.Util;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.PlayerInventory; import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.inventory.container.Container; import net.minecraft.inventory.container.Container;
@ -28,13 +27,10 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull; import javax.annotation.Nonnull;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase.NBTType;
public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider { public class TileEntityFermentingBarrel extends TileEntityBase implements ISharingFluidHandler, INamedContainerProvider {
private static final int PROCESS_TIME = 100; private static final int PROCESS_TIME = 100;
@ -155,8 +151,8 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
public class FermentingBarrelMultiTank implements IFluidHandler { public class FermentingBarrelMultiTank implements IFluidHandler {
public FluidStack canolaTank = new FluidStack(InitFluids.fluidCanolaOil.get(), 0); public FluidStack canolaTank = new FluidStack(InitFluids.CANOLA_OIL.get(), 0);
public FluidStack oilTank = new FluidStack(InitFluids.fluidRefinedCanolaOil.get(), 0); public FluidStack oilTank = new FluidStack(InitFluids.REFINED_CANOLA_OIL.get(), 0);
private int capacity = FluidAttributes.BUCKET_VOLUME * 2; private int capacity = FluidAttributes.BUCKET_VOLUME * 2;
@Override @Override
@ -177,12 +173,12 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
@Override @Override
public boolean isFluidValid(int tank, @Nonnull FluidStack stack) { public boolean isFluidValid(int tank, @Nonnull FluidStack stack) {
return tank == 0? stack.getFluid() == InitFluids.fluidCanolaOil.get():stack.getFluid() == InitFluids.fluidRefinedCanolaOil.get(); return tank == 0? stack.getFluid() == InitFluids.CANOLA_OIL.get():stack.getFluid() == InitFluids.REFINED_CANOLA_OIL.get();
} }
@Override @Override
public int fill(FluidStack resource, FluidAction action) { public int fill(FluidStack resource, FluidAction action) {
if (resource.isEmpty() || resource.getFluid() != InitFluids.fluidCanolaOil.get()) if (resource.isEmpty() || resource.getFluid() != InitFluids.CANOLA_OIL.get())
return 0; return 0;
if(action.simulate()) if(action.simulate())
@ -230,7 +226,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
@Nonnull @Nonnull
@Override @Override
public FluidStack drain(FluidStack resource, FluidAction action) { public FluidStack drain(FluidStack resource, FluidAction action) {
if (resource.isEmpty() || resource.getFluid() != InitFluids.fluidRefinedCanolaOil.get()) if (resource.isEmpty() || resource.getFluid() != InitFluids.REFINED_CANOLA_OIL.get())
return FluidStack.EMPTY; return FluidStack.EMPTY;
return drain(resource.getAmount(), action); return drain(resource.getAmount(), action);