Skip to content
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

fix mystical agriculture integration for harvest ritual #2013

Open
wants to merge 1 commit into
base: 1.18.2
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,14 @@ public HarvestHandlerPlantable()
@Override
public boolean harvest(Level world, BlockPos pos, BlockState state, List<ItemStack> drops)
{
// NonNullList<ItemStack> blockDrops = NonNullList.create();
// state.getBlock().getDrops(blockDrops, world, pos, state, 0);
// NonNullList<ItemStack> blockDrops = NonNullList.create();
// state.getBlock().getDrops(blockDrops, world, pos, state, 0);
boolean foundSeed = false;
LootContext.Builder lootBuilder = new LootContext.Builder((ServerLevel) world);
Vec3 blockCenter = new Vec3(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
List<ItemStack> blockDrops = state.getDrops(lootBuilder.withParameter(LootContextParams.ORIGIN, blockCenter).withParameter(LootContextParams.TOOL, mockHoe));

// System.out.println("Size of list: " + blockDrops.size());
// System.out.println("Size of list: " + blockDrops.size());

for (ItemStack stack : blockDrops)
{
Expand All @@ -90,7 +90,7 @@ public boolean harvest(Level world, BlockPos pos, BlockState state, List<ItemSta
}
}

// System.out.println("Found seed: " + foundSeed);
// System.out.println("Found seed: " + foundSeed);

if (foundSeed)
{
Expand All @@ -113,9 +113,11 @@ public boolean harvest(Level world, BlockPos pos, BlockState state, List<ItemSta
@Override
public boolean test(Level world, BlockPos pos, BlockState state)
{
// state.hasProperty(null);
// state.hasProperty(null);
return HarvestRegistry.getStandardCrops().containsKey(state.getBlock()) && state.getBlock() instanceof CropBlock && ((CropBlock) state.getBlock()).isMaxAge(state);
// return HarvestRegistry.getStandardCrops().containsKey(state.getBlock()) && state.getBlock().getMetaFromState(state) == HarvestRegistry.getStandardCrops().get(state.getBlock());
// return HarvestRegistry.getStandardCrops().containsKey(state.getBlock()) &&
// state.getBlock().getMetaFromState(state) ==
// HarvestRegistry.getStandardCrops().get(state.getBlock());
}

private static void addThirdPartyCrop(String modid, String regName, int matureMeta)
Expand Down Expand Up @@ -171,8 +173,8 @@ private static void addMysticalCrops()
@SuppressWarnings("unchecked")
List<Object> crops = (List<Object>) getCrops.invoke(registry);

Class<?> mysticalCrop = Class.forName("com.blakebr0.mysticalagriculture.api.crop.ICrop");
Method getCrop = mysticalCrop.getMethod("getCrop");
Class<?> mysticalCrop = Class.forName("com.blakebr0.mysticalagriculture.api.crop.Crop");
Method getCrop = mysticalCrop.getMethod("getCropBlock");

for (Object maCrop : crops)
{
Expand Down