mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-21 23:13:28 +01:00
well the press... almost works...
This commit is contained in:
parent
ebb9200957
commit
99521c64a1
25 changed files with 357 additions and 93 deletions
|
@ -85,6 +85,7 @@ dependencies {
|
||||||
runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}")
|
runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}")
|
||||||
|
|
||||||
runtimeOnly fg.deobf("curse.maven:TOP-245211:3319255")
|
runtimeOnly fg.deobf("curse.maven:TOP-245211:3319255")
|
||||||
|
runtimeOnly fg.deobf("curse.maven:MEK-268560:3590099")
|
||||||
}
|
}
|
||||||
|
|
||||||
// not sure if this is still needed
|
// not sure if this is still needed
|
||||||
|
|
|
@ -7,10 +7,10 @@ mod_version=1.1.52
|
||||||
|
|
||||||
# Forge
|
# Forge
|
||||||
game_version=1.16.5
|
game_version=1.16.5
|
||||||
forge_version=36.2.8
|
forge_version=36.2.22
|
||||||
|
|
||||||
# Parchment (Mappings)
|
# Parchment (Mappings)
|
||||||
parchment_version=2021.10.17
|
parchment_version=2021.10.17
|
||||||
|
|
||||||
# Other mods
|
# Other mods
|
||||||
jei_version=1.16.4:7.6.1.71
|
jei_version=1.16.5:7.7.1.117
|
||||||
|
|
|
@ -14,7 +14,7 @@ c93b89c4b673b6063148666b2eb13dec98918532 assets/actuallyadditions/blockstates/bl
|
||||||
ac5d75bda4dc24894fb380d5e3ec751a0aa5c498 assets/actuallyadditions/blockstates/black_quartz_stair.json
|
ac5d75bda4dc24894fb380d5e3ec751a0aa5c498 assets/actuallyadditions/blockstates/black_quartz_stair.json
|
||||||
146faa2ebbb31f320f8b336f6e675fce6faac2db assets/actuallyadditions/blockstates/black_quartz_wall.json
|
146faa2ebbb31f320f8b336f6e675fce6faac2db assets/actuallyadditions/blockstates/black_quartz_wall.json
|
||||||
5dea2f0e554a5ecb9b7f547526d745ff85353a40 assets/actuallyadditions/blockstates/breaker.json
|
5dea2f0e554a5ecb9b7f547526d745ff85353a40 assets/actuallyadditions/blockstates/breaker.json
|
||||||
48eb2c3f1180c04e668046abc65dbadeaaf3aed6 assets/actuallyadditions/blockstates/canola.json
|
273dff01ca0d0738f05639086aa4f1b6bf3fde3c assets/actuallyadditions/blockstates/canola_crop.json
|
||||||
5101139337dd4e5a057333e9e424df47f7138c93 assets/actuallyadditions/blockstates/canola_press.json
|
5101139337dd4e5a057333e9e424df47f7138c93 assets/actuallyadditions/blockstates/canola_press.json
|
||||||
c8d5786cd66f324b82d201e6e4eb0ae0a5978d13 assets/actuallyadditions/blockstates/charcoal_block.json
|
c8d5786cd66f324b82d201e6e4eb0ae0a5978d13 assets/actuallyadditions/blockstates/charcoal_block.json
|
||||||
998b11d1f63e153ab2f8bd11830405611c8886a2 assets/actuallyadditions/blockstates/chiseled_black_quartz_block.json
|
998b11d1f63e153ab2f8bd11830405611c8886a2 assets/actuallyadditions/blockstates/chiseled_black_quartz_block.json
|
||||||
|
@ -146,7 +146,7 @@ f277709029801d7292d300b13876189a32d1b3a4 assets/actuallyadditions/models/block/b
|
||||||
93b61ddd8e53f61ca25c4768de3a3b95a23297b4 assets/actuallyadditions/models/block/black_quartz_wall_post.json
|
93b61ddd8e53f61ca25c4768de3a3b95a23297b4 assets/actuallyadditions/models/block/black_quartz_wall_post.json
|
||||||
1c617e7845d3211b4f7cda38a9bee59208de8c23 assets/actuallyadditions/models/block/black_quartz_wall_side.json
|
1c617e7845d3211b4f7cda38a9bee59208de8c23 assets/actuallyadditions/models/block/black_quartz_wall_side.json
|
||||||
46c7aa812a7af600d4f927eba5fa3f5b4956fa28 assets/actuallyadditions/models/block/black_quartz_wall_side_tall.json
|
46c7aa812a7af600d4f927eba5fa3f5b4956fa28 assets/actuallyadditions/models/block/black_quartz_wall_side_tall.json
|
||||||
e3b1972935fa68ca5feaad8f7412530df5d6b8a2 assets/actuallyadditions/models/block/canola.json
|
f399ee0d5977015e82c733336cd6317dee65aefe assets/actuallyadditions/models/block/canola_crop.json
|
||||||
49e551c7f9943bd24b1fa09fb65836bae48096df assets/actuallyadditions/models/block/charcoal_block.json
|
49e551c7f9943bd24b1fa09fb65836bae48096df assets/actuallyadditions/models/block/charcoal_block.json
|
||||||
48a6232ced27b9a35fc236705adb2ea817a03b3f assets/actuallyadditions/models/block/chiseled_black_quartz_slab.json
|
48a6232ced27b9a35fc236705adb2ea817a03b3f assets/actuallyadditions/models/block/chiseled_black_quartz_slab.json
|
||||||
85a969896c0aad4f70878d4c075c6c0885a5ade4 assets/actuallyadditions/models/block/chiseled_black_quartz_slab_top.json
|
85a969896c0aad4f70878d4c075c6c0885a5ade4 assets/actuallyadditions/models/block/chiseled_black_quartz_slab_top.json
|
||||||
|
@ -250,7 +250,8 @@ dfb8604b25fc7a671c371a81e3384410c69cc7b1 assets/actuallyadditions/models/item/bl
|
||||||
ea2f5b2bf99670f4df05889ab67c73686a26a58b assets/actuallyadditions/models/item/black_quartz_stair.json
|
ea2f5b2bf99670f4df05889ab67c73686a26a58b assets/actuallyadditions/models/item/black_quartz_stair.json
|
||||||
be227e074a54982e1e9f9f304e63df3095006955 assets/actuallyadditions/models/item/black_quartz_wall.json
|
be227e074a54982e1e9f9f304e63df3095006955 assets/actuallyadditions/models/item/black_quartz_wall.json
|
||||||
3679056a9aee03821a997a2616b8808af7bfe4b7 assets/actuallyadditions/models/item/breaker.json
|
3679056a9aee03821a997a2616b8808af7bfe4b7 assets/actuallyadditions/models/item/breaker.json
|
||||||
f3282e55e71d26a32cee1287881ac2d5e91c30a8 assets/actuallyadditions/models/item/canola.json
|
e1b2c741f6da5cfb51392b1a722c4d664ae2400e assets/actuallyadditions/models/item/canola.json
|
||||||
|
89b4704399440cae3ffdee004e5df95cbc0ab0d8 assets/actuallyadditions/models/item/canola_crop.json
|
||||||
e4b8fbed9602c0cf96eff84111586799412982fc assets/actuallyadditions/models/item/canola_oil_bucket.json
|
e4b8fbed9602c0cf96eff84111586799412982fc assets/actuallyadditions/models/item/canola_oil_bucket.json
|
||||||
08c70d561c219bb4c6d21b5f56192df81f054e0a assets/actuallyadditions/models/item/canola_press.json
|
08c70d561c219bb4c6d21b5f56192df81f054e0a assets/actuallyadditions/models/item/canola_press.json
|
||||||
0507025fadef30e363cbc825265576c782880f7b assets/actuallyadditions/models/item/canola_seeds.json
|
0507025fadef30e363cbc825265576c782880f7b assets/actuallyadditions/models/item/canola_seeds.json
|
||||||
|
@ -683,6 +684,7 @@ b0b8c23e30fa6890c6cb3b4bcb0c21170e6e6cfd data/actuallyadditions/recipes/palis_le
|
||||||
c91d538c767c582f8dbd9008c59d2069b253d85b data/actuallyadditions/recipes/palis_shovel.json
|
c91d538c767c582f8dbd9008c59d2069b253d85b data/actuallyadditions/recipes/palis_shovel.json
|
||||||
34f63da2e20810935ec211fb1a5e7cfc5d6d19e3 data/actuallyadditions/recipes/palis_sword.json
|
34f63da2e20810935ec211fb1a5e7cfc5d6d19e3 data/actuallyadditions/recipes/palis_sword.json
|
||||||
4590b472dcb90700ea525a3c6ac3f325458fab19 data/actuallyadditions/recipes/phantom_connector.json
|
4590b472dcb90700ea525a3c6ac3f325458fab19 data/actuallyadditions/recipes/phantom_connector.json
|
||||||
|
6a1050a9aaadea6d3961b7e77ee17880404a56e0 data/actuallyadditions/recipes/pressing/canola.json
|
||||||
68e7d4bd5e6ea852ef57ff5032d922a9a703fd77 data/actuallyadditions/recipes/quadruple_battery.json
|
68e7d4bd5e6ea852ef57ff5032d922a9a703fd77 data/actuallyadditions/recipes/quadruple_battery.json
|
||||||
fe64f278992ae37581a7b50e0870b222d9e9577e data/actuallyadditions/recipes/quartz_aiot.json
|
fe64f278992ae37581a7b50e0870b222d9e9577e data/actuallyadditions/recipes/quartz_aiot.json
|
||||||
d64fe5965c8274ca27a5fcb0a83d372ed817e62f data/actuallyadditions/recipes/quartz_axe.json
|
d64fe5965c8274ca27a5fcb0a83d372ed817e62f data/actuallyadditions/recipes/quartz_axe.json
|
||||||
|
|
|
@ -1,7 +0,0 @@
|
||||||
{
|
|
||||||
"variants": {
|
|
||||||
"": {
|
|
||||||
"model": "actuallyadditions:block/canola"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
{
|
||||||
|
"variants": {
|
||||||
|
"": {
|
||||||
|
"model": "actuallyadditions:block/canola_crop"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "minecraft:block/cube_all",
|
"parent": "minecraft:block/cube_all",
|
||||||
"textures": {
|
"textures": {
|
||||||
"all": "actuallyadditions:block/canola"
|
"all": "actuallyadditions:block/canola_crop"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,3 +1,6 @@
|
||||||
{
|
{
|
||||||
"parent": "actuallyadditions:block/canola"
|
"parent": "minecraft:item/handheld",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "actuallyadditions:item/canola"
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"parent": "actuallyadditions:block/canola_crop"
|
||||||
|
}
|
|
@ -0,0 +1,10 @@
|
||||||
|
{
|
||||||
|
"type": "actuallyadditions:pressing",
|
||||||
|
"ingredient": {
|
||||||
|
"item": "actuallyadditions:canola"
|
||||||
|
},
|
||||||
|
"result": {
|
||||||
|
"fluid": "actuallyadditions:canola_oil",
|
||||||
|
"amount": 80
|
||||||
|
}
|
||||||
|
}
|
|
@ -21,6 +21,7 @@ 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.CrushingRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.EmpowererRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
||||||
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
|
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
|
@ -48,6 +49,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<PressingRecipe> PRESSING_RECIPES = new ArrayList<>();
|
||||||
/**
|
/**
|
||||||
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
* Farmer behaviors are sorted when first accessed, this will not be done until after loading, but do not add behaviors at runtime.
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,6 +37,7 @@ public class ActuallyAdditionsData {
|
||||||
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 SolidFuelGenerator(generator));
|
||||||
|
generator.addProvider(new MiscMachineRecipeGenerator(generator));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
|
import net.minecraft.data.DataGenerator;
|
||||||
|
import net.minecraft.data.DirectoryCache;
|
||||||
|
import net.minecraft.data.IFinishedRecipe;
|
||||||
|
import net.minecraft.data.RecipeProvider;
|
||||||
|
import net.minecraft.item.crafting.Ingredient;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
|
||||||
|
public class MiscMachineRecipeGenerator extends RecipeProvider {
|
||||||
|
public MiscMachineRecipeGenerator(DataGenerator pGenerator) {
|
||||||
|
super(pGenerator);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void saveAdvancement(DirectoryCache pCache, JsonObject pAdvancementJson, Path pPath) {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void buildShapelessRecipes(Consumer<IFinishedRecipe> consumer) {
|
||||||
|
consumer.accept(new PressingRecipe.FinishedRecipe(new ResourceLocation(ActuallyAdditions.MODID, "pressing/canola"), Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)));
|
||||||
|
}
|
||||||
|
}
|
|
@ -264,7 +264,7 @@ public final class ActuallyBlocks {
|
||||||
//TODO: Are plants normal blocks / blockitems? i have no idea... news at 11...
|
//TODO: Are plants normal blocks / blockitems? i have no idea... news at 11...
|
||||||
public static final AABlockReg<BlockPlant, AABlockItem, ?> RICE = new AABlockReg<>("rice", () -> new BlockPlant(ActuallyItems.RICE_SEEDS),
|
public static final AABlockReg<BlockPlant, AABlockItem, ?> RICE = new AABlockReg<>("rice", () -> new BlockPlant(ActuallyItems.RICE_SEEDS),
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<BlockPlant, AABlockItem, ?> CANOLA = new AABlockReg<>("canola", () -> new BlockPlant(ActuallyItems.CANOLA_SEEDS),
|
public static final AABlockReg<BlockPlant, AABlockItem, ?> CANOLA = new AABlockReg<>("canola_crop", () -> new BlockPlant(ActuallyItems.CANOLA_SEEDS),
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
public static final AABlockReg<BlockPlant, AABlockItem, ?> FLAX = new AABlockReg<>("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEEDS),
|
public static final AABlockReg<BlockPlant, AABlockItem, ?> FLAX = new AABlockReg<>("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEEDS),
|
||||||
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
(b) -> new AABlockItem(b, defaultBlockItemProperties));
|
||||||
|
|
|
@ -40,11 +40,16 @@ public class BlockCanolaPress extends BlockContainerBase {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
//@Override
|
@Override
|
||||||
public TileEntity newBlockEntity(IBlockReader world) {
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return new TileEntityCanolaPress();
|
return new TileEntityCanolaPress();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean hasTileEntity(BlockState state) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
|
||||||
if (!world.isClientSide) {
|
if (!world.isClientSide) {
|
||||||
|
|
|
@ -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<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -29,7 +30,7 @@ public class ActuallyRecipes {
|
||||||
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> 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");
|
||||||
//public static final IRecipeType<FermentingRecipe> FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting");
|
//public static final IRecipeType<FermentingRecipe> FERMENTING = IRecipeType.register(ActuallyAdditions.MODID + ":fermenting");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,154 @@
|
||||||
|
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 PressingRecipe implements IRecipe<IInventory> {
|
||||||
|
public static final String NAME = "pressing";
|
||||||
|
private final ResourceLocation ID;
|
||||||
|
private final Ingredient input;
|
||||||
|
private final FluidStack output;
|
||||||
|
|
||||||
|
public PressingRecipe(ResourceLocation ID, Ingredient input, FluidStack output) {
|
||||||
|
this.ID = ID;
|
||||||
|
this.input = input;
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean matches(@Nonnull IInventory pInv, @Nullable 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;
|
||||||
|
}
|
||||||
|
|
||||||
|
public FluidStack getOutput() {
|
||||||
|
return this.output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack getResultItem() {
|
||||||
|
return ItemStack.EMPTY;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IRecipeSerializer<?> getSerializer() {
|
||||||
|
return ActuallyRecipes.PRESSING_RECIPE.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IRecipeType<?> getType() {
|
||||||
|
return ActuallyRecipes.Types.PRESSING;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class Serializer extends ForgeRegistryEntry<IRecipeSerializer<?>> implements IRecipeSerializer<PressingRecipe> {
|
||||||
|
@Nonnull
|
||||||
|
@Override
|
||||||
|
public PressingRecipe fromJson(@Nonnull ResourceLocation pRecipeId, @Nonnull JsonObject pJson) {
|
||||||
|
Ingredient ingredient = Ingredient.fromJson(JSONUtils.getAsJsonObject(pJson, "ingredient"));
|
||||||
|
JsonObject result = pJson.getAsJsonObject("result");
|
||||||
|
ResourceLocation fluidRes = new ResourceLocation(JSONUtils.getAsString(result, "fluid"));
|
||||||
|
int fluidAmount = JSONUtils.getAsInt(result, "amount");
|
||||||
|
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
||||||
|
if(fluid == null)
|
||||||
|
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||||
|
FluidStack output = new FluidStack(fluid, fluidAmount);
|
||||||
|
|
||||||
|
return new PressingRecipe(pRecipeId, ingredient, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public PressingRecipe fromNetwork(@Nonnull ResourceLocation pRecipeId, @Nonnull PacketBuffer pBuffer) {
|
||||||
|
Ingredient ingredient = Ingredient.fromNetwork(pBuffer);
|
||||||
|
ResourceLocation fluidRes = new ResourceLocation(pBuffer.readUtf());
|
||||||
|
int fluidAmount = pBuffer.readInt();
|
||||||
|
Fluid fluid = ForgeRegistries.FLUIDS.getValue(fluidRes);
|
||||||
|
if(fluid == null)
|
||||||
|
throw new JsonParseException("Unknown fluid '" + fluidRes + "'");
|
||||||
|
FluidStack output = new FluidStack(fluid, fluidAmount);
|
||||||
|
|
||||||
|
return new PressingRecipe(pRecipeId, ingredient, output);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void toNetwork(@Nonnull PacketBuffer pBuffer, @Nonnull PressingRecipe pRecipe) {
|
||||||
|
pRecipe.input.toNetwork(pBuffer);
|
||||||
|
pBuffer.writeUtf(pRecipe.output.getFluid().getRegistryName().toString());
|
||||||
|
pBuffer.writeInt(pRecipe.output.getAmount());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static class FinishedRecipe implements IFinishedRecipe {
|
||||||
|
private final ResourceLocation ID;
|
||||||
|
private final Ingredient input;
|
||||||
|
private final FluidStack output;
|
||||||
|
|
||||||
|
public FinishedRecipe(ResourceLocation ID, Ingredient input, FluidStack output) {
|
||||||
|
this.ID = ID;
|
||||||
|
this.input = input;
|
||||||
|
this.output = output;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void serializeRecipeData(JsonObject pJson) {
|
||||||
|
pJson.add("ingredient", input.toJson());
|
||||||
|
JsonObject result = new JsonObject();
|
||||||
|
result.addProperty("fluid", output.getFluid().getRegistryName().toString());
|
||||||
|
result.addProperty("amount", output.getAmount());
|
||||||
|
pJson.add("result", result);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getId() {
|
||||||
|
return ID;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public IRecipeSerializer<?> getType() {
|
||||||
|
return ActuallyRecipes.PRESSING_RECIPE.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public JsonObject serializeAdvancement() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public ResourceLocation getAdvancementId() {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||||
|
|
||||||
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||||
|
|
||||||
|
import java.util.function.Predicate;
|
||||||
|
|
||||||
|
public class OutputOnlyFluidTank extends FluidTank {
|
||||||
|
public OutputOnlyFluidTank(int capacity) {
|
||||||
|
super(capacity, (FluidStack fluidStack) -> true);
|
||||||
|
}
|
||||||
|
|
||||||
|
public OutputOnlyFluidTank(int capacity, Predicate<FluidStack> validator) {
|
||||||
|
super(capacity, validator);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int fill(FluidStack resource, FluidAction action) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int fillInternal(FluidStack resource, FluidAction action) {
|
||||||
|
return super.fill(resource, action);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -11,18 +11,28 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
package de.ellpeck.actuallyadditions.mod.inventory.gui;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.AbstractGui;
|
import net.minecraft.client.gui.AbstractGui;
|
||||||
import net.minecraft.fluid.Fluid;
|
import net.minecraft.fluid.Fluid;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.IFluidTank;
|
||||||
|
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||||
|
import net.minecraftforge.fml.client.gui.GuiUtils;
|
||||||
|
|
||||||
|
import java.text.NumberFormat;
|
||||||
|
import java.util.Collections;
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public class FluidDisplay extends AbstractGui {
|
public class FluidDisplay extends AbstractGui {
|
||||||
|
|
||||||
private FluidStack fluidReference;
|
private IFluidTank fluidReference;
|
||||||
private Fluid oldFluid;
|
private Fluid oldFluid;
|
||||||
|
|
||||||
private int x;
|
private int x;
|
||||||
|
@ -33,15 +43,15 @@ public class FluidDisplay extends AbstractGui {
|
||||||
|
|
||||||
private boolean drawTextNextTo;
|
private boolean drawTextNextTo;
|
||||||
|
|
||||||
public FluidDisplay(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
|
public FluidDisplay(int x, int y, IFluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
|
||||||
this.setData(x, y, fluidReference, outline, drawTextNextTo);
|
this.setData(x, y, fluidReference, outline, drawTextNextTo);
|
||||||
}
|
}
|
||||||
|
|
||||||
public FluidDisplay(int x, int y, FluidStack fluidReference) {
|
public FluidDisplay(int x, int y, IFluidTank fluidReference) {
|
||||||
this(x, y, fluidReference, false, false);
|
this(x, y, fluidReference, false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setData(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
|
public void setData(int x, int y, IFluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
|
||||||
this.x = x;
|
this.x = x;
|
||||||
this.y = y;
|
this.y = y;
|
||||||
this.fluidReference = fluidReference;
|
this.fluidReference = fluidReference;
|
||||||
|
@ -50,7 +60,7 @@ public class FluidDisplay extends AbstractGui {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void draw(MatrixStack matrices) {
|
public void draw(MatrixStack matrices) {
|
||||||
/* Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
|
mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
|
||||||
|
|
||||||
int barX = this.x;
|
int barX = this.x;
|
||||||
|
@ -65,15 +75,13 @@ public class FluidDisplay extends AbstractGui {
|
||||||
this.blit(matrices, barX, barY, 0, 171, 18, 85);
|
this.blit(matrices, barX, barY, 0, 171, 18, 85);
|
||||||
|
|
||||||
FluidStack stack = this.fluidReference.getFluid();
|
FluidStack stack = this.fluidReference.getFluid();
|
||||||
Fluid fluid = stack == null
|
Fluid fluid = stack.getFluid();
|
||||||
? null
|
|
||||||
: stack.getFluid();
|
|
||||||
|
|
||||||
if (this.resLoc == null || this.oldFluid != fluid) {
|
if (this.resLoc == null || this.oldFluid != stack.getFluid()) {
|
||||||
this.oldFluid = fluid;
|
this.oldFluid = stack.getFluid();
|
||||||
|
|
||||||
if (fluid != null && fluid.getStill() != null) {
|
if (fluid != null && fluid.getAttributes().getStillTexture() != null) {
|
||||||
this.resLoc = new ResourceLocation(fluid.getStill().getNamespace(), "textures/" + fluid.getStill().getPath() + ".png");
|
this.resLoc = new ResourceLocation(fluid.getAttributes().getStillTexture().getNamespace(), "textures/" + fluid.getAttributes().getStillTexture().getPath() + ".png");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,18 +90,19 @@ public class FluidDisplay extends AbstractGui {
|
||||||
|
|
||||||
GlStateManager._pushMatrix();
|
GlStateManager._pushMatrix();
|
||||||
GlStateManager._enableBlend();
|
GlStateManager._enableBlend();
|
||||||
GlStateManager.disableAlpha();
|
GlStateManager._disableAlphaTest();
|
||||||
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
|
GlStateManager._blendFuncSeparate(770, 771, 1, 0);
|
||||||
int i = this.fluidReference.getFluidAmount() * 83 / this.fluidReference.getCapacity();
|
int i = this.fluidReference.getFluid().getAmount() * 83 / this.fluidReference.getCapacity();
|
||||||
Gui.drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512);
|
blit(matrices, barX + 1, barY + 84 - i, 0, 0, 36, 172, 16, i, 16, 512);
|
||||||
|
//drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512);
|
||||||
GlStateManager._disableBlend();
|
GlStateManager._disableBlend();
|
||||||
GlStateManager.enableAlpha();
|
GlStateManager._enableAlphaTest();
|
||||||
GlStateManager._popMatrix();
|
GlStateManager._popMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.drawTextNextTo) {
|
if (this.drawTextNextTo) {
|
||||||
this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
|
mc.font.draw(matrices, new StringTextComponent(this.getOverlayText()), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void render(MatrixStack matrices, int mouseX, int mouseY) {
|
public void render(MatrixStack matrices, int mouseX, int mouseY) {
|
||||||
|
@ -103,17 +112,16 @@ public class FluidDisplay extends AbstractGui {
|
||||||
? 93
|
? 93
|
||||||
: 85)) {
|
: 85)) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
//GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
|
GuiUtils.drawHoveringText(matrices, Collections.singletonList(new StringTextComponent(this.getOverlayText())), mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getOverlayText() {
|
private String getOverlayText() {
|
||||||
/* NumberFormat format = NumberFormat.getInstance();
|
NumberFormat format = NumberFormat.getInstance();
|
||||||
FluidStack stack = this.fluidReference.getFluid();
|
FluidStack stack = this.fluidReference.getFluid();
|
||||||
String cap = format.format(this.fluidReference.getCapacity());
|
String cap = format.format(this.fluidReference.getCapacity());
|
||||||
return stack == null || stack.getFluid() == null
|
return stack.isEmpty()
|
||||||
? "0/" + cap + " mB"
|
? "0/" + cap + " mB"
|
||||||
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName();*/
|
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getDisplayName().getString();
|
||||||
return "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,8 +41,11 @@ public class GuiCanolaPress extends AAScreen<ContainerCanolaPress> {
|
||||||
@Override
|
@Override
|
||||||
public void init() {
|
public void init() {
|
||||||
super.init();
|
super.init();
|
||||||
//this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage);
|
this.energy = new EnergyDisplay(this.leftPos + 42, this.topPos + 5, this.press.storage);
|
||||||
//this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank);
|
this.fluid = new FluidDisplay(this.leftPos + 116, this.topPos + 5, this.press.tank);
|
||||||
|
|
||||||
|
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
|
||||||
|
titleLabelY = -10;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -53,11 +56,6 @@ public class GuiCanolaPress extends AAScreen<ContainerCanolaPress> {
|
||||||
this.fluid.render(matrices, x, y);
|
this.fluid.render(matrices, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void renderLabels(@Nonnull MatrixStack matrices, int x, int y) {
|
|
||||||
AssetUtil.displayNameString(matrices, this.font, this.imageWidth, -10, this.press);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void renderBg(MatrixStack matrices, float f, int x, int y) {
|
public void renderBg(MatrixStack matrices, float f, int x, int y) {
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
|
|
@ -37,7 +37,7 @@ public final class ActuallyItems {
|
||||||
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ActuallyAdditions.MODID);
|
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
// MISC ITEMS
|
// MISC ITEMS
|
||||||
// public static final RegistryObject<Item> CANOLA = ITEMS.register("canola", ItemBase::new);
|
public static final RegistryObject<Item> CANOLA = ITEMS.register("canola", ItemBase::new);
|
||||||
public static final RegistryObject<Item> COFFEE_CUP = ITEMS.register("coffee_cup", ItemBase::new);
|
public static final RegistryObject<Item> COFFEE_CUP = ITEMS.register("coffee_cup", ItemBase::new);
|
||||||
public static final RegistryObject<Item> PAPER_CONE = ITEMS.register("paper_cone", ItemBase::new);
|
public static final RegistryObject<Item> PAPER_CONE = ITEMS.register("paper_cone", ItemBase::new);
|
||||||
public static final RegistryObject<Item> DOUGH = ITEMS.register("dough", ItemBase::new);
|
public static final RegistryObject<Item> DOUGH = ITEMS.register("dough", ItemBase::new);
|
||||||
|
@ -292,7 +292,7 @@ public final class ActuallyItems {
|
||||||
RESTONIA_CRYSTAL_SHARD, PALIS_CRYSTAL_SHARD, DIAMATINE_CRYSTAL_SHARD, VOID_CRYSTAL_SHARD, EMERADIC_CRYSTAL_SHARD,
|
RESTONIA_CRYSTAL_SHARD, PALIS_CRYSTAL_SHARD, DIAMATINE_CRYSTAL_SHARD, VOID_CRYSTAL_SHARD, EMERADIC_CRYSTAL_SHARD,
|
||||||
ENORI_CRYSTAL_SHARD, ENGINEERS_GOGGLES, ENGINEERS_GOGGLES_ADVANCED, LASER_UPGRADE_RANGE, LASER_UPGRADE_INVISIBILITY,
|
ENORI_CRYSTAL_SHARD, ENGINEERS_GOGGLES, ENGINEERS_GOGGLES_ADVANCED, LASER_UPGRADE_RANGE, LASER_UPGRADE_INVISIBILITY,
|
||||||
HANDHELD_FILLER, TRAVELERS_SACK, VOID_SACK, WORM, PLAYER_PROBE, FILTER, WATER_BOWL, PAPER_CONE, DOUGH,
|
HANDHELD_FILLER, TRAVELERS_SACK, VOID_SACK, WORM, PLAYER_PROBE, FILTER, WATER_BOWL, PAPER_CONE, DOUGH,
|
||||||
RING, BASIC_COIL, ADVANCED_COIL, RICE_DOUGH, TINY_COAL, TINY_CHARCOAL, RICE_SLIMEBALL, /*CANOLA,*/ EMPTY_CUP,
|
RING, BASIC_COIL, ADVANCED_COIL, RICE_DOUGH, TINY_COAL, TINY_CHARCOAL, RICE_SLIMEBALL, CANOLA, EMPTY_CUP,
|
||||||
BATS_WING, DRILL_CORE, LENS, ENDER_STAR, CRYSTALLIZED_CANOLA_SEED, EMPOWERED_CANOLA_SEED, LENS_OF_COLOR,
|
BATS_WING, DRILL_CORE, LENS, ENDER_STAR, CRYSTALLIZED_CANOLA_SEED, EMPOWERED_CANOLA_SEED, LENS_OF_COLOR,
|
||||||
LENS_OF_DETONATION, LENS_OF_CERTAIN_DEATH, LENS_OF_THE_KILLER, LENS_OF_DISENCHANTING, LENS_OF_THE_MINER,
|
LENS_OF_DETONATION, LENS_OF_CERTAIN_DEATH, LENS_OF_THE_KILLER, LENS_OF_DISENCHANTING, LENS_OF_THE_MINER,
|
||||||
LASER_WRENCH, TELEPORT_STAFF, WINGS_OF_THE_BATS, SINGLE_BATTERY, DOUBLE_BATTERY, TRIPLE_BATTERY, QUADRUPLE_BATTERY, QUINTUPLE_BATTERY,
|
LASER_WRENCH, TELEPORT_STAFF, WINGS_OF_THE_BATS, SINGLE_BATTERY, DOUBLE_BATTERY, TRIPLE_BATTERY, QUADRUPLE_BATTERY, QUINTUPLE_BATTERY,
|
||||||
|
|
|
@ -10,8 +10,12 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.tile;
|
package de.ellpeck.actuallyadditions.mod.tile;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.crafting.SingleItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.fluids.OutputOnlyFluidTank;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
|
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
|
||||||
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;
|
||||||
|
@ -26,31 +30,29 @@ import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.util.Direction;
|
import net.minecraft.util.Direction;
|
||||||
import net.minecraft.util.text.ITextComponent;
|
import net.minecraft.util.text.ITextComponent;
|
||||||
import net.minecraft.util.text.StringTextComponent;
|
import net.minecraft.util.text.StringTextComponent;
|
||||||
|
import net.minecraft.util.text.TranslationTextComponent;
|
||||||
import net.minecraftforge.api.distmarker.Dist;
|
import net.minecraftforge.api.distmarker.Dist;
|
||||||
import net.minecraftforge.api.distmarker.OnlyIn;
|
import net.minecraftforge.api.distmarker.OnlyIn;
|
||||||
import net.minecraftforge.common.util.LazyOptional;
|
import net.minecraftforge.common.util.LazyOptional;
|
||||||
import net.minecraftforge.energy.IEnergyStorage;
|
import net.minecraftforge.energy.IEnergyStorage;
|
||||||
|
import net.minecraftforge.fluids.FluidAttributes;
|
||||||
import net.minecraftforge.fluids.FluidStack;
|
import net.minecraftforge.fluids.FluidStack;
|
||||||
|
import net.minecraftforge.fluids.IFluidTank;
|
||||||
import net.minecraftforge.fluids.capability.IFluidHandler;
|
import net.minecraftforge.fluids.capability.IFluidHandler;
|
||||||
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
import net.minecraftforge.fluids.capability.templates.FluidTank;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
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;
|
||||||
public static final int ENERGY_USE = 35;
|
public static final int ENERGY_USE = 35;
|
||||||
private static final int TIME = 30;
|
private static final int TIME = 30;
|
||||||
public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100, 0);
|
public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100, 0);
|
||||||
public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
|
public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
|
||||||
|
|
||||||
public final FluidTank tank = new FluidTank(2 * Util.BUCKET) {
|
public final OutputOnlyFluidTank tank = new OutputOnlyFluidTank(2 * FluidAttributes.BUCKET_VOLUME);
|
||||||
// TODO: [port] ensure this is the correct replacement for canFill
|
|
||||||
@Override
|
|
||||||
public boolean isFluidValid(FluidStack stack) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
public final LazyOptional<IFluidHandler> lazyFluid = LazyOptional.of(() -> this.tank);
|
public final LazyOptional<IFluidHandler> lazyFluid = LazyOptional.of(() -> this.tank);
|
||||||
|
|
||||||
public int currentProcessTime;
|
public int currentProcessTime;
|
||||||
|
@ -62,9 +64,9 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
|
||||||
super(ActuallyBlocks.CANOLA_PRESS.getTileEntityType(), 1);
|
super(ActuallyBlocks.CANOLA_PRESS.getTileEntityType(), 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean isCanola(ItemStack stack) {
|
// public static boolean isCanola(ItemStack stack) {
|
||||||
return stack.getItem() == ActuallyBlocks.CANOLA.getItem();
|
// return stack.getItem() == ActuallyBlocks.CANOLA.getItem();
|
||||||
}
|
// }
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public int getTankScaled(int i) {
|
public int getTankScaled(int i) {
|
||||||
|
@ -105,22 +107,25 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
if (!this.level.isClientSide) {
|
if (!this.level.isClientSide) {
|
||||||
if (isCanola(this.inv.getStackInSlot(0)) && PRODUCE <= this.tank.getCapacity() - this.tank.getFluidAmount()) {
|
Optional<PressingRecipe> recipe = getRecipeForInput(this.inv.getStackInSlot(0));
|
||||||
if (this.storage.getEnergyStored() >= ENERGY_USE) {
|
recipe.ifPresent(r -> {
|
||||||
this.currentProcessTime++;
|
if ((r.getOutput().isFluidEqual(this.tank.getFluid()) || this.tank.isEmpty()) && r.getOutput().getAmount() <= this.tank.getCapacity() - this.tank.getFluidAmount()) {
|
||||||
this.storage.extractEnergyInternal(ENERGY_USE, false);
|
if (this.storage.getEnergyStored() >= ENERGY_USE) {
|
||||||
if (this.currentProcessTime >= TIME) {
|
this.currentProcessTime++;
|
||||||
this.currentProcessTime = 0;
|
this.storage.extractEnergyInternal(ENERGY_USE, false);
|
||||||
|
if (this.currentProcessTime >= TIME) {
|
||||||
|
this.currentProcessTime = 0;
|
||||||
|
|
||||||
this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1));
|
this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1));
|
||||||
|
FluidStack produced = r.getOutput().copy();
|
||||||
this.tank.fill(new FluidStack(InitFluids.CANOLA_OIL.get(), PRODUCE), IFluidHandler.FluidAction.EXECUTE);
|
this.tank.fillInternal(produced, IFluidHandler.FluidAction.EXECUTE);
|
||||||
this.setChanged();
|
this.setChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
});
|
||||||
|
if (!recipe.isPresent())
|
||||||
this.currentProcessTime = 0;
|
this.currentProcessTime = 0;
|
||||||
}
|
|
||||||
|
|
||||||
if ((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()) {
|
if ((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()) {
|
||||||
this.lastEnergyStored = this.storage.getEnergyStored();
|
this.lastEnergyStored = this.storage.getEnergyStored();
|
||||||
|
@ -130,9 +135,17 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean validInput(ItemStack stack) {
|
||||||
|
return getRecipeForInput(stack).isPresent();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Optional<PressingRecipe> getRecipeForInput(ItemStack stack) {
|
||||||
|
return ActuallyAdditionsAPI.PRESSING_RECIPES.stream().filter(recipe -> recipe.matches(new SingleItem(stack), null)).findFirst();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IAcceptor getAcceptor() {
|
public IAcceptor getAcceptor() {
|
||||||
return (slot, stack, automation) -> slot == 0 && isCanola(stack);
|
return (slot, stack, automation) -> slot == 0 && validInput(stack);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -167,7 +180,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ITextComponent getDisplayName() {
|
public ITextComponent getDisplayName() {
|
||||||
return StringTextComponent.EMPTY;
|
return new TranslationTextComponent("container.actuallyadditions.canola_press");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
|
@ -27,6 +27,7 @@ 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;
|
||||||
|
@ -74,8 +75,8 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
|
||||||
if (this.currentProcessTime >= PROCESS_TIME) {
|
if (this.currentProcessTime >= PROCESS_TIME) {
|
||||||
this.currentProcessTime = 0;
|
this.currentProcessTime = 0;
|
||||||
|
|
||||||
this.tanks.oilTank.grow(produce);
|
this.tanks.oilTank.getFluid().grow(produce);
|
||||||
this.tanks.canolaTank.shrink(produce);
|
this.tanks.canolaTank.getFluid().shrink(produce);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.currentProcessTime = 0;
|
this.currentProcessTime = 0;
|
||||||
|
@ -151,9 +152,9 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
|
||||||
|
|
||||||
public class FermentingBarrelMultiTank implements IFluidHandler {
|
public class FermentingBarrelMultiTank implements IFluidHandler {
|
||||||
|
|
||||||
public FluidStack canolaTank = new FluidStack(InitFluids.CANOLA_OIL.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;
|
||||||
|
public FluidTank canolaTank = new FluidTank(capacity);
|
||||||
|
public FluidTank oilTank = new FluidTank(capacity);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getTanks() {
|
public int getTanks() {
|
||||||
|
@ -163,7 +164,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
|
||||||
@Nonnull
|
@Nonnull
|
||||||
@Override
|
@Override
|
||||||
public FluidStack getFluidInTank(int tank) {
|
public FluidStack getFluidInTank(int tank) {
|
||||||
return tank == 0? canolaTank:oilTank;
|
return tank == 0 ? canolaTank.getFluid() : oilTank.getFluid();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -186,22 +187,22 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
|
||||||
if (canolaTank.isEmpty())
|
if (canolaTank.isEmpty())
|
||||||
return Math.min(capacity, resource.getAmount());
|
return Math.min(capacity, resource.getAmount());
|
||||||
else
|
else
|
||||||
return Math.min(capacity - canolaTank.getAmount(), resource.getAmount());
|
return Math.min(capacity - canolaTank.getFluid().getAmount(), resource.getAmount());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (canolaTank.isEmpty()) {
|
if (canolaTank.isEmpty()) {
|
||||||
canolaTank = new FluidStack(resource, Math.min(capacity, resource.getAmount()));
|
canolaTank.fill(new FluidStack(resource, Math.min(capacity, resource.getAmount())), FluidAction.EXECUTE);
|
||||||
//TODO need to set the BE dirty.
|
//TODO need to set the BE dirty.
|
||||||
return canolaTank.getAmount();
|
return canolaTank.getFluid().getAmount();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
int filledAmt = capacity - canolaTank.getAmount();
|
int filledAmt = capacity - canolaTank.getFluid().getAmount();
|
||||||
if (resource.getAmount() < filledAmt) {
|
if (resource.getAmount() < filledAmt) {
|
||||||
canolaTank.grow(resource.getAmount());
|
canolaTank.getFluid().grow(resource.getAmount());
|
||||||
filledAmt = resource.getAmount();
|
filledAmt = resource.getAmount();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
canolaTank.setAmount(capacity);
|
canolaTank.getFluid().setAmount(capacity);
|
||||||
|
|
||||||
if (filledAmt > 0){
|
if (filledAmt > 0){
|
||||||
//TODO set BE dirty
|
//TODO set BE dirty
|
||||||
|
@ -236,14 +237,14 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
|
||||||
@Override
|
@Override
|
||||||
public FluidStack drain(int maxDrain, FluidAction action) {
|
public FluidStack drain(int maxDrain, FluidAction action) {
|
||||||
int drained = maxDrain;
|
int drained = maxDrain;
|
||||||
if (oilTank.getAmount() < drained)
|
if (oilTank.getFluid().getAmount() < drained)
|
||||||
{
|
{
|
||||||
drained = oilTank.getAmount();
|
drained = oilTank.getFluid().getAmount();
|
||||||
}
|
}
|
||||||
FluidStack stack = new FluidStack(oilTank, drained);
|
FluidStack stack = new FluidStack(oilTank.getFluid(), drained);
|
||||||
if (action.execute() && drained > 0)
|
if (action.execute() && drained > 0)
|
||||||
{
|
{
|
||||||
oilTank.shrink(drained);
|
oilTank.getFluid().shrink(drained);
|
||||||
//TODO set BE dirty
|
//TODO set BE dirty
|
||||||
}
|
}
|
||||||
return stack;
|
return stack;
|
||||||
|
|
|
@ -23,5 +23,8 @@ 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.PRESSING_RECIPES.clear();
|
||||||
|
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -296,7 +296,7 @@
|
||||||
"item.actuallyadditions.coffee_seed": "Coffee Seeds",
|
"item.actuallyadditions.coffee_seed": "Coffee Seeds",
|
||||||
"item.actuallyadditions.coffee_beans": "Coffee Beans",
|
"item.actuallyadditions.coffee_beans": "Coffee Beans",
|
||||||
"item.actuallyadditions.canola_seed": "Canola Seeds",
|
"item.actuallyadditions.canola_seed": "Canola Seeds",
|
||||||
"item.actuallyadditions.misc_canola": "Canola",
|
"item.actuallyadditions.canola": "Canola",
|
||||||
"item.actuallyadditions.resonant_rice": "Resonant Rice",
|
"item.actuallyadditions.resonant_rice": "Resonant Rice",
|
||||||
"item.actuallyadditions.drill_upgrade_speed": "Drill Speed Augment I",
|
"item.actuallyadditions.drill_upgrade_speed": "Drill Speed Augment I",
|
||||||
"item.actuallyadditions.drill_upgrade_speed_ii": "Drill Speed Augment II",
|
"item.actuallyadditions.drill_upgrade_speed_ii": "Drill Speed Augment II",
|
||||||
|
@ -642,7 +642,7 @@
|
||||||
"container.actuallyadditions.breaker": "Breaker",
|
"container.actuallyadditions.breaker": "Breaker",
|
||||||
"container.actuallyadditions.dropper": "Precision Dropper",
|
"container.actuallyadditions.dropper": "Precision Dropper",
|
||||||
"container.actuallyadditions.crafting": "Crafting Table On A Stick",
|
"container.actuallyadditions.crafting": "Crafting Table On A Stick",
|
||||||
"container.actuallyadditions.canolaPress": "Canola Press",
|
"container.actuallyadditions.canola_press": "Canola Press",
|
||||||
"container.actuallyadditions.fermentingBarrel": "Fermenting Barrel",
|
"container.actuallyadditions.fermentingBarrel": "Fermenting Barrel",
|
||||||
"container.actuallyadditions.coalGenerator": "Coal Generator",
|
"container.actuallyadditions.coalGenerator": "Coal Generator",
|
||||||
"container.actuallyadditions.oilGenerator": "Oil Generator",
|
"container.actuallyadditions.oilGenerator": "Oil Generator",
|
||||||
|
|
Before Width: | Height: | Size: 282 B After Width: | Height: | Size: 282 B |
Loading…
Reference in a new issue