-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for fluid tanks in feeding slabs #625
base: dev-1.21.0
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,6 +59,8 @@ | |
import net.minecraft.world.level.pathfinder.PathType; | ||
import net.minecraft.world.phys.AABB; | ||
import net.minecraft.world.phys.HitResult; | ||
import net.neoforged.neoforge.capabilities.Capabilities; | ||
import net.neoforged.neoforge.fluids.capability.IFluidHandler; | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.annotation.Nullable; | ||
|
@@ -561,6 +563,10 @@ public boolean isFlowerItem(ItemStack flowerItem) { | |
if (flowerItem.getItem() instanceof BlockItem blockItem && isFlowerBlock(blockItem.getBlock().defaultBlockState())) { | ||
return true; | ||
} | ||
IFluidHandler flowerFluid = flowerItem.getCapability(Capabilities.FluidHandler.ITEM); | ||
if (flowerFluid != null && flowerFluid.getFluidInTank(0).getAmount() >= ProductiveBeesConfig.BEES.minimumMbForFlowering.get()) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. there's only a check for the amount here, what about the fluid type? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was basing it mainly off the existing flower block system which uses the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't want a default flowering fluid, this here looks like it would enable any bee to flower off of a bucket of water. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I thought that was checked for else where so I did a test. I'm not really sure how to do a proper test for this tbh, but I did 2 in game tests for half an hour each: both with 2 advanced hives and 4 Omega upgrades, 1 with a lava bucket in a feeding slab, 1 with a water bucket in a feeding slab. I put a water bee in both, and for the first test, just let it run, for the second test, I swapped the water bee to pollinate with lava to test it. Test 1, only the water hive filled with anything, test 2, only the lava hive filled with anything. |
||
return true; | ||
} | ||
return BeeHelper.hasItemConversionRecipe(this, flowerItem); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about fluids that don't have blocks?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Afaik, there's no way for fluids without blocks to be used right now so it would be consistent with the current behavior, but if I'm wrong or you want it to work for fluids without blocks, I would need to modify the call to be
TagKey<Item> tag
rather thanTagKey<Block> tag
which I'm fine doing, I was just trying not to change the existing code too much.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the code again, I can't seem to find anywhere that non block fluids work at all, but if you can give me an example of how to use a fluid that doesn't have a block before this PR, I can definitely look at how that one is done.