Skip to content

Commit c46a78b

Browse files
committed
Fixed crash with sapling loot & with DTTFC addon
1 parent 28b5ce1 commit c46a78b

File tree

3 files changed

+7
-2
lines changed

3 files changed

+7
-2
lines changed

gradle.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
modName=DynamicTrees
22
modId=dynamictrees
3-
modVersion=1.4.0
3+
modVersion=1.4.1
44

55
group=com.ferreusveritas.dynamictrees
66

src/main/java/com/ferreusveritas/dynamictrees/block/DynamicSaplingBlock.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,9 @@
2222
import net.minecraft.world.level.material.PushReaction;
2323
import net.minecraft.world.level.storage.loot.LootDataType;
2424
import net.minecraft.world.level.storage.loot.LootParams;
25+
import net.minecraft.world.level.storage.loot.parameters.LootContextParams;
2526
import net.minecraft.world.phys.HitResult;
27+
import net.minecraft.world.phys.Vec3;
2628
import net.minecraft.world.phys.shapes.CollisionContext;
2729
import net.minecraft.world.phys.shapes.VoxelShape;
2830
import net.minecraftforge.common.IPlantable;
@@ -132,7 +134,7 @@ public void neighborChanged(BlockState state, Level level, BlockPos pos, Block b
132134

133135
protected void dropBlock(Level level, BlockState state, BlockPos pos) {
134136
if (level instanceof ServerLevel serverLevel){
135-
getDrops(state, new LootParams.Builder(serverLevel)).forEach((drop) -> popResource(level, pos, drop));
137+
getDrops(state, new LootParams.Builder(serverLevel).withParameter(LootContextParams.ORIGIN, Vec3.atCenterOf(pos)).withParameter(LootContextParams.TOOL, ItemStack.EMPTY)).forEach((drop) -> popResource(level, pos, drop));
136138
level.removeBlock(pos, false);
137139
}
138140
}

src/main/java/com/ferreusveritas/dynamictrees/block/leaves/DynamicLeavesBlock.java

+3
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ public boolean growLeavesIfLocationIsSuitable(LevelAccessor level, LeavesPropert
317317
}
318318
return false;
319319
}
320+
public boolean growLeavesIfLocationIsSuitable(LevelAccessor level, LeavesProperties leavesProp, BlockPos pos, int hydro) {
321+
return growLeavesIfLocationIsSuitable(level, leavesProp, pos, (Integer) hydro);
322+
}
320323

321324
/**
322325
* Checks the {@link Block} at the given {@link BlockPos} is suitable for growing new leaves.

0 commit comments

Comments
 (0)