Compare commits

..

No commits in common. "21ca731de1726095eb44a920f0076e3f154bb149" and "ebb9200957d23657971340ca5663451859560780" have entirely different histories.

26 changed files with 103 additions and 379 deletions

View file

@ -85,7 +85,6 @@ dependencies {
runtimeOnly fg.deobf("mezz.jei:jei-${jei_version}")
runtimeOnly fg.deobf("curse.maven:TOP-245211:3319255")
runtimeOnly fg.deobf("curse.maven:MEK-268560:3590099")
}
// not sure if this is still needed

View file

@ -7,10 +7,10 @@ mod_version=1.1.52
# Forge
game_version=1.16.5
forge_version=36.2.22
forge_version=36.2.8
# Parchment (Mappings)
parchment_version=2021.10.17
# Other mods
jei_version=1.16.5:7.7.1.117
jei_version=1.16.4:7.6.1.71

View file

@ -14,7 +14,7 @@ c93b89c4b673b6063148666b2eb13dec98918532 assets/actuallyadditions/blockstates/bl
ac5d75bda4dc24894fb380d5e3ec751a0aa5c498 assets/actuallyadditions/blockstates/black_quartz_stair.json
146faa2ebbb31f320f8b336f6e675fce6faac2db assets/actuallyadditions/blockstates/black_quartz_wall.json
5dea2f0e554a5ecb9b7f547526d745ff85353a40 assets/actuallyadditions/blockstates/breaker.json
273dff01ca0d0738f05639086aa4f1b6bf3fde3c assets/actuallyadditions/blockstates/canola_crop.json
48eb2c3f1180c04e668046abc65dbadeaaf3aed6 assets/actuallyadditions/blockstates/canola.json
5101139337dd4e5a057333e9e424df47f7138c93 assets/actuallyadditions/blockstates/canola_press.json
c8d5786cd66f324b82d201e6e4eb0ae0a5978d13 assets/actuallyadditions/blockstates/charcoal_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
1c617e7845d3211b4f7cda38a9bee59208de8c23 assets/actuallyadditions/models/block/black_quartz_wall_side.json
46c7aa812a7af600d4f927eba5fa3f5b4956fa28 assets/actuallyadditions/models/block/black_quartz_wall_side_tall.json
f399ee0d5977015e82c733336cd6317dee65aefe assets/actuallyadditions/models/block/canola_crop.json
e3b1972935fa68ca5feaad8f7412530df5d6b8a2 assets/actuallyadditions/models/block/canola.json
49e551c7f9943bd24b1fa09fb65836bae48096df assets/actuallyadditions/models/block/charcoal_block.json
48a6232ced27b9a35fc236705adb2ea817a03b3f assets/actuallyadditions/models/block/chiseled_black_quartz_slab.json
85a969896c0aad4f70878d4c075c6c0885a5ade4 assets/actuallyadditions/models/block/chiseled_black_quartz_slab_top.json
@ -250,8 +250,7 @@ dfb8604b25fc7a671c371a81e3384410c69cc7b1 assets/actuallyadditions/models/item/bl
ea2f5b2bf99670f4df05889ab67c73686a26a58b assets/actuallyadditions/models/item/black_quartz_stair.json
be227e074a54982e1e9f9f304e63df3095006955 assets/actuallyadditions/models/item/black_quartz_wall.json
3679056a9aee03821a997a2616b8808af7bfe4b7 assets/actuallyadditions/models/item/breaker.json
e1b2c741f6da5cfb51392b1a722c4d664ae2400e assets/actuallyadditions/models/item/canola.json
89b4704399440cae3ffdee004e5df95cbc0ab0d8 assets/actuallyadditions/models/item/canola_crop.json
f3282e55e71d26a32cee1287881ac2d5e91c30a8 assets/actuallyadditions/models/item/canola.json
e4b8fbed9602c0cf96eff84111586799412982fc assets/actuallyadditions/models/item/canola_oil_bucket.json
08c70d561c219bb4c6d21b5f56192df81f054e0a assets/actuallyadditions/models/item/canola_press.json
0507025fadef30e363cbc825265576c782880f7b assets/actuallyadditions/models/item/canola_seeds.json
@ -684,7 +683,6 @@ b0b8c23e30fa6890c6cb3b4bcb0c21170e6e6cfd data/actuallyadditions/recipes/palis_le
c91d538c767c582f8dbd9008c59d2069b253d85b data/actuallyadditions/recipes/palis_shovel.json
34f63da2e20810935ec211fb1a5e7cfc5d6d19e3 data/actuallyadditions/recipes/palis_sword.json
4590b472dcb90700ea525a3c6ac3f325458fab19 data/actuallyadditions/recipes/phantom_connector.json
6a1050a9aaadea6d3961b7e77ee17880404a56e0 data/actuallyadditions/recipes/pressing/canola.json
68e7d4bd5e6ea852ef57ff5032d922a9a703fd77 data/actuallyadditions/recipes/quadruple_battery.json
fe64f278992ae37581a7b50e0870b222d9e9577e data/actuallyadditions/recipes/quartz_aiot.json
d64fe5965c8274ca27a5fcb0a83d372ed817e62f data/actuallyadditions/recipes/quartz_axe.json

View file

@ -0,0 +1,7 @@
{
"variants": {
"": {
"model": "actuallyadditions:block/canola"
}
}
}

View file

@ -1,7 +0,0 @@
{
"variants": {
"": {
"model": "actuallyadditions:block/canola_crop"
}
}
}

View file

@ -1,6 +1,6 @@
{
"parent": "minecraft:block/cube_all",
"textures": {
"all": "actuallyadditions:block/canola_crop"
"all": "actuallyadditions:block/canola"
}
}

View file

@ -1,6 +1,3 @@
{
"parent": "minecraft:item/handheld",
"textures": {
"layer0": "actuallyadditions:item/canola"
}
"parent": "actuallyadditions:block/canola"
}

View file

@ -1,3 +0,0 @@
{
"parent": "actuallyadditions:block/canola_crop"
}

View file

@ -1,10 +0,0 @@
{
"type": "actuallyadditions:pressing",
"ingredient": {
"item": "actuallyadditions:canola"
},
"result": {
"fluid": "actuallyadditions:canola_oil",
"amount": 80
}
}

View file

@ -21,7 +21,6 @@ import de.ellpeck.actuallyadditions.api.lens.LensConversion;
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.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.crafting.SolidFuelRecipe;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
@ -49,7 +48,6 @@ public final class ActuallyAdditionsAPI {
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<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.
*/

View file

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

View file

@ -1,39 +0,0 @@
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.fluid.Fluids;
import net.minecraft.item.crafting.Ingredient;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.Tags;
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(folderRecipe("pressing", "canola"),
Ingredient.of(ActuallyItems.CANOLA.get()), new FluidStack(InitFluids.CANOLA_OIL.get(), 80)));
}
private ResourceLocation folderRecipe(String folder, String recipe) {
return new ResourceLocation(ActuallyAdditions.MODID, folder + "/" + recipe);
}
}

View file

@ -264,7 +264,7 @@ public final class ActuallyBlocks {
//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),
(b) -> new AABlockItem(b, defaultBlockItemProperties));
public static final AABlockReg<BlockPlant, AABlockItem, ?> CANOLA = new AABlockReg<>("canola_crop", () -> new BlockPlant(ActuallyItems.CANOLA_SEEDS),
public static final AABlockReg<BlockPlant, AABlockItem, ?> CANOLA = new AABlockReg<>("canola", () -> new BlockPlant(ActuallyItems.CANOLA_SEEDS),
(b) -> new AABlockItem(b, defaultBlockItemProperties));
public static final AABlockReg<BlockPlant, AABlockItem, ?> FLAX = new AABlockReg<>("flax", () -> new BlockPlant(ActuallyItems.FLAX_SEEDS),
(b) -> new AABlockItem(b, defaultBlockItemProperties));

View file

@ -24,7 +24,6 @@ import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidUtil;
import net.minecraftforge.fml.network.NetworkHooks;
import javax.annotation.Nullable;
@ -41,29 +40,23 @@ public class BlockCanolaPress extends BlockContainerBase {
// }
@Nullable
@Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
//@Override
public TileEntity newBlockEntity(IBlockReader world) {
return new TileEntityCanolaPress();
}
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override
public ActionResultType use(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) {
TileEntityCanolaPress tile = (TileEntityCanolaPress) world.getBlockEntity(pos);
if (tile == null)
return ActionResultType.PASS; //TODO this logic all needs to be rechecked...
if (world.isClientSide)
return ActionResultType.SUCCESS;
if (!player.isShiftKeyDown()) {
if (!FluidUtil.interactWithFluidHandler(player, hand, tile.tank))
NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos);
return ActionResultType.SUCCESS;
if (!world.isClientSide) {
TileEntityCanolaPress tile = (TileEntityCanolaPress) world.getBlockEntity(pos);
if (tile != null) {
if (!this.tryUseItemOnTank(player, hand, tile.tank)) {
NetworkHooks.openGui((ServerPlayerEntity) player, tile, pos);
}
}
return ActionResultType.PASS;
}
return ActionResultType.PASS;
return super.use(state, world, pos, player, hand, hit);
}
@Override

View file

@ -20,7 +20,6 @@ public class ActuallyRecipes {
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<?>> SOLID_FUEL_RECIPE = SERIALIZERS.register(SolidFuelRecipe.NAME, SolidFuelRecipe.Serializer::new);
public static final RegistryObject<IRecipeSerializer<?>> PRESSING_RECIPE = SERIALIZERS.register(PressingRecipe.NAME, PressingRecipe.Serializer::new);
@ -30,7 +29,7 @@ public class ActuallyRecipes {
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<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");
}
}

View file

@ -1,154 +0,0 @@
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;
}
}
}

View file

@ -1,27 +0,0 @@
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);
}
}

View file

@ -11,7 +11,6 @@
package de.ellpeck.actuallyadditions.mod.inventory;
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
import de.ellpeck.actuallyadditions.mod.crafting.PressingRecipe;
import de.ellpeck.actuallyadditions.mod.inventory.slot.SlotItemHandlerUnconditioned;
import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress;
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
@ -23,7 +22,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import java.util.Objects;
import java.util.Optional;
public class ContainerCanolaPress extends Container {
@ -65,8 +63,7 @@ public class ContainerCanolaPress extends Container {
//Other Slots in Inventory excluded
if (slot >= inventoryStart) {
//Shift from Inventory
Optional<PressingRecipe> recipeOptional = TileEntityCanolaPress.getRecipeForInput(newStack);
if (recipeOptional.isPresent()) {
if (newStack.getItem() == ActuallyBlocks.CANOLA.getItem()) {
if (!this.moveItemStackTo(newStack, 0, 1, false)) {
return StackUtil.getEmpty();
}

View file

@ -11,28 +11,18 @@
package de.ellpeck.actuallyadditions.mod.inventory.gui;
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.gui.AbstractGui;
import net.minecraft.fluid.Fluid;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.text.StringTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
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)
public class FluidDisplay extends AbstractGui {
private IFluidTank fluidReference;
private FluidStack fluidReference;
private Fluid oldFluid;
private int x;
@ -43,15 +33,15 @@ public class FluidDisplay extends AbstractGui {
private boolean drawTextNextTo;
public FluidDisplay(int x, int y, IFluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
public FluidDisplay(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
this.setData(x, y, fluidReference, outline, drawTextNextTo);
}
public FluidDisplay(int x, int y, IFluidTank fluidReference) {
public FluidDisplay(int x, int y, FluidStack fluidReference) {
this(x, y, fluidReference, false, false);
}
public void setData(int x, int y, IFluidTank fluidReference, boolean outline, boolean drawTextNextTo) {
public void setData(int x, int y, FluidStack fluidReference, boolean outline, boolean drawTextNextTo) {
this.x = x;
this.y = y;
this.fluidReference = fluidReference;
@ -60,7 +50,7 @@ public class FluidDisplay extends AbstractGui {
}
public void draw(MatrixStack matrices) {
Minecraft mc = Minecraft.getInstance();
/* Minecraft mc = Minecraft.getInstance();
mc.getTextureManager().bind(AssetUtil.GUI_INVENTORY_LOCATION);
int barX = this.x;
@ -75,13 +65,15 @@ public class FluidDisplay extends AbstractGui {
this.blit(matrices, barX, barY, 0, 171, 18, 85);
FluidStack stack = this.fluidReference.getFluid();
Fluid fluid = stack.getFluid();
Fluid fluid = stack == null
? null
: stack.getFluid();
if (this.resLoc == null || this.oldFluid != stack.getFluid()) {
this.oldFluid = stack.getFluid();
if (this.resLoc == null || this.oldFluid != fluid) {
this.oldFluid = fluid;
if (fluid != null && fluid.getAttributes().getStillTexture() != null) {
this.resLoc = new ResourceLocation(fluid.getAttributes().getStillTexture().getNamespace(), "textures/" + fluid.getAttributes().getStillTexture().getPath() + ".png");
if (fluid != null && fluid.getStill() != null) {
this.resLoc = new ResourceLocation(fluid.getStill().getNamespace(), "textures/" + fluid.getStill().getPath() + ".png");
}
}
@ -90,19 +82,18 @@ public class FluidDisplay extends AbstractGui {
GlStateManager._pushMatrix();
GlStateManager._enableBlend();
GlStateManager._disableAlphaTest();
GlStateManager._blendFuncSeparate(770, 771, 1, 0);
int i = this.fluidReference.getFluid().getAmount() * 83 / this.fluidReference.getCapacity();
this.blit(matrices, barX + 1, barY + 84 - i, 0, 0, 16, i, 16, 512);
//drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512);
GlStateManager.disableAlpha();
GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
int i = this.fluidReference.getFluidAmount() * 83 / this.fluidReference.getCapacity();
Gui.drawModalRectWithCustomSizedTexture(barX + 1, barY + 84 - i, 36, 172, 16, i, 16, 512);
GlStateManager._disableBlend();
GlStateManager._enableAlphaTest();
GlStateManager.enableAlpha();
GlStateManager._popMatrix();
}
if (this.drawTextNextTo) {
mc.font.draw(matrices, new StringTextComponent(this.getOverlayText()), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
}
this.drawString(mc.font, this.getOverlayText(), barX + 25, barY + 78, StringUtil.DECIMAL_COLOR_WHITE);
}*/
}
public void render(MatrixStack matrices, int mouseX, int mouseY) {
@ -112,16 +103,17 @@ public class FluidDisplay extends AbstractGui {
? 93
: 85)) {
Minecraft mc = Minecraft.getInstance();
GuiUtils.drawHoveringText(matrices, Collections.singletonList(new StringTextComponent(this.getOverlayText())), mouseX, mouseY, mc.getWindow().getWidth(), mc.getWindow().getHeight(), -1, mc.font);
//GuiUtils.drawHoveringText(Collections.singletonList(this.getOverlayText()), mouseX, mouseY, mc.displayWidth, mc.displayHeight, -1, mc.font);
}
}
private String getOverlayText() {
NumberFormat format = NumberFormat.getInstance();
/* NumberFormat format = NumberFormat.getInstance();
FluidStack stack = this.fluidReference.getFluid();
String cap = format.format(this.fluidReference.getCapacity());
return stack.isEmpty()
return stack == null || stack.getFluid() == null
? "0/" + cap + " mB"
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getDisplayName().getString();
: format.format(this.fluidReference.getFluidAmount()) + "/" + cap + " mB " + stack.getLocalizedName();*/
return "";
}
}

View file

@ -41,11 +41,8 @@ public class GuiCanolaPress extends AAScreen<ContainerCanolaPress> {
@Override
public void init() {
super.init();
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);
titleLabelX = (int) (imageWidth / 2.0f - font.width(title) / 2.0f);
titleLabelY = -10;
//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);
}
@Override
@ -56,6 +53,11 @@ public class GuiCanolaPress extends AAScreen<ContainerCanolaPress> {
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
public void renderBg(MatrixStack matrices, float f, int x, int y) {
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);

View file

@ -37,7 +37,7 @@ public final class ActuallyItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, ActuallyAdditions.MODID);
// 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> PAPER_CONE = ITEMS.register("paper_cone", 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,
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,
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,
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,

View file

@ -10,12 +10,8 @@
package de.ellpeck.actuallyadditions.mod.tile;
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
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.OutputOnlyFluidTank;
import de.ellpeck.actuallyadditions.mod.inventory.ContainerCanolaPress;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IAcceptor;
import de.ellpeck.actuallyadditions.mod.util.ItemStackHandlerAA.IRemover;
@ -30,29 +26,31 @@ import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.text.StringTextComponent;
import net.minecraft.util.text.TranslationTextComponent;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidTank;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nullable;
import java.util.Optional;
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;
private static final int TIME = 30;
public final CustomEnergyStorage storage = new CustomEnergyStorage(40000, 100, 0);
public final LazyOptional<IEnergyStorage> lazyEnergy = LazyOptional.of(() -> this.storage);
public final OutputOnlyFluidTank tank = new OutputOnlyFluidTank(2 * FluidAttributes.BUCKET_VOLUME);
public final FluidTank tank = new FluidTank(2 * Util.BUCKET) {
// 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 int currentProcessTime;
@ -64,9 +62,9 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
super(ActuallyBlocks.CANOLA_PRESS.getTileEntityType(), 1);
}
// public static boolean isCanola(ItemStack stack) {
// return stack.getItem() == ActuallyBlocks.CANOLA.getItem();
// }
public static boolean isCanola(ItemStack stack) {
return stack.getItem() == ActuallyBlocks.CANOLA.getItem();
}
@OnlyIn(Dist.CLIENT)
public int getTankScaled(int i) {
@ -107,25 +105,22 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
public void updateEntity() {
super.updateEntity();
if (!this.level.isClientSide) {
Optional<PressingRecipe> recipe = getRecipeForInput(this.inv.getStackInSlot(0));
recipe.ifPresent(r -> {
if ((r.getOutput().isFluidEqual(this.tank.getFluid()) || this.tank.isEmpty()) && r.getOutput().getAmount() <= this.tank.getCapacity() - this.tank.getFluidAmount()) {
if (this.storage.getEnergyStored() >= ENERGY_USE) {
this.currentProcessTime++;
this.storage.extractEnergyInternal(ENERGY_USE, false);
if (this.currentProcessTime >= TIME) {
this.currentProcessTime = 0;
if (isCanola(this.inv.getStackInSlot(0)) && PRODUCE <= this.tank.getCapacity() - this.tank.getFluidAmount()) {
if (this.storage.getEnergyStored() >= ENERGY_USE) {
this.currentProcessTime++;
this.storage.extractEnergyInternal(ENERGY_USE, false);
if (this.currentProcessTime >= TIME) {
this.currentProcessTime = 0;
this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1));
FluidStack produced = r.getOutput().copy();
this.tank.fillInternal(produced, IFluidHandler.FluidAction.EXECUTE);
this.setChanged();
}
this.inv.setStackInSlot(0, StackUtil.shrink(this.inv.getStackInSlot(0), 1));
this.tank.fill(new FluidStack(InitFluids.CANOLA_OIL.get(), PRODUCE), IFluidHandler.FluidAction.EXECUTE);
this.setChanged();
}
}
});
if (!recipe.isPresent())
} else {
this.currentProcessTime = 0;
}
if ((this.storage.getEnergyStored() != this.lastEnergyStored || this.tank.getFluidAmount() != this.lastTankAmount | this.currentProcessTime != this.lastProcessTime) && this.sendUpdateWithInterval()) {
this.lastEnergyStored = this.storage.getEnergyStored();
@ -135,17 +130,9 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
}
}
public boolean validInput(ItemStack stack) {
return getRecipeForInput(stack).isPresent();
}
public static Optional<PressingRecipe> getRecipeForInput(ItemStack stack) {
return ActuallyAdditionsAPI.PRESSING_RECIPES.stream().filter(recipe -> recipe.matches(new SingleItem(stack), null)).findFirst();
}
@Override
public IAcceptor getAcceptor() {
return (slot, stack, automation) -> slot == 0 && validInput(stack);
return (slot, stack, automation) -> slot == 0 && isCanola(stack);
}
@Override
@ -180,7 +167,7 @@ public class TileEntityCanolaPress extends TileEntityInventoryBase implements IN
@Override
public ITextComponent getDisplayName() {
return new TranslationTextComponent("container.actuallyadditions.canola_press");
return StringTextComponent.EMPTY;
}
@Nullable

View file

@ -27,7 +27,6 @@ import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.fluids.FluidAttributes;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.capability.IFluidHandler;
import net.minecraftforge.fluids.capability.templates.FluidTank;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
@ -75,8 +74,8 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
if (this.currentProcessTime >= PROCESS_TIME) {
this.currentProcessTime = 0;
this.tanks.oilTank.getFluid().grow(produce);
this.tanks.canolaTank.getFluid().shrink(produce);
this.tanks.oilTank.grow(produce);
this.tanks.canolaTank.shrink(produce);
}
} else {
this.currentProcessTime = 0;
@ -152,9 +151,9 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
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;
public FluidTank canolaTank = new FluidTank(capacity);
public FluidTank oilTank = new FluidTank(capacity);
@Override
public int getTanks() {
@ -164,7 +163,7 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
@Nonnull
@Override
public FluidStack getFluidInTank(int tank) {
return tank == 0 ? canolaTank.getFluid() : oilTank.getFluid();
return tank == 0? canolaTank:oilTank;
}
@Override
@ -187,22 +186,22 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
if (canolaTank.isEmpty())
return Math.min(capacity, resource.getAmount());
else
return Math.min(capacity - canolaTank.getFluid().getAmount(), resource.getAmount());
return Math.min(capacity - canolaTank.getAmount(), resource.getAmount());
}
else {
if (canolaTank.isEmpty()) {
canolaTank.fill(new FluidStack(resource, Math.min(capacity, resource.getAmount())), FluidAction.EXECUTE);
canolaTank = new FluidStack(resource, Math.min(capacity, resource.getAmount()));
//TODO need to set the BE dirty.
return canolaTank.getFluid().getAmount();
return canolaTank.getAmount();
}
else {
int filledAmt = capacity - canolaTank.getFluid().getAmount();
int filledAmt = capacity - canolaTank.getAmount();
if (resource.getAmount() < filledAmt) {
canolaTank.getFluid().grow(resource.getAmount());
canolaTank.grow(resource.getAmount());
filledAmt = resource.getAmount();
}
else
canolaTank.getFluid().setAmount(capacity);
canolaTank.setAmount(capacity);
if (filledAmt > 0){
//TODO set BE dirty
@ -237,14 +236,14 @@ public class TileEntityFermentingBarrel extends TileEntityBase implements IShari
@Override
public FluidStack drain(int maxDrain, FluidAction action) {
int drained = maxDrain;
if (oilTank.getFluid().getAmount() < drained)
if (oilTank.getAmount() < drained)
{
drained = oilTank.getFluid().getAmount();
drained = oilTank.getAmount();
}
FluidStack stack = new FluidStack(oilTank.getFluid(), drained);
FluidStack stack = new FluidStack(oilTank, drained);
if (action.execute() && drained > 0)
{
oilTank.getFluid().shrink(drained);
oilTank.shrink(drained);
//TODO set BE dirty
}
return stack;

View file

@ -23,8 +23,5 @@ public class ResourceReloader implements IResourceManagerReloadListener {
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.clear();
ActuallyAdditionsAPI.SOLID_FUEL_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.SOLID_FUEL));
ActuallyAdditionsAPI.PRESSING_RECIPES.clear();
ActuallyAdditionsAPI.PRESSING_RECIPES.addAll(recipeManager.getAllRecipesFor(ActuallyRecipes.Types.PRESSING));
}
}

View file

@ -296,7 +296,7 @@
"item.actuallyadditions.coffee_seed": "Coffee Seeds",
"item.actuallyadditions.coffee_beans": "Coffee Beans",
"item.actuallyadditions.canola_seed": "Canola Seeds",
"item.actuallyadditions.canola": "Canola",
"item.actuallyadditions.misc_canola": "Canola",
"item.actuallyadditions.resonant_rice": "Resonant Rice",
"item.actuallyadditions.drill_upgrade_speed": "Drill Speed Augment I",
"item.actuallyadditions.drill_upgrade_speed_ii": "Drill Speed Augment II",
@ -642,7 +642,7 @@
"container.actuallyadditions.breaker": "Breaker",
"container.actuallyadditions.dropper": "Precision Dropper",
"container.actuallyadditions.crafting": "Crafting Table On A Stick",
"container.actuallyadditions.canola_press": "Canola Press",
"container.actuallyadditions.canolaPress": "Canola Press",
"container.actuallyadditions.fermentingBarrel": "Fermenting Barrel",
"container.actuallyadditions.coalGenerator": "Coal Generator",
"container.actuallyadditions.oilGenerator": "Oil Generator",