Re-Activate Dynamic Trees Compat

This commit is contained in:
attackeight 2024-04-23 15:39:37 -04:00
parent d66170c8fe
commit 4d2c35b11b
3 changed files with 33 additions and 22 deletions

View file

@ -194,9 +194,14 @@ dependencies {
runtimeOnly fg.deobf("org.squiddev:cc-tweaked-${cc_tweaked_minecraft_version}:${cc_tweaked_version}")
}
compileOnly fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-${dynamic_trees_minecraft_version}:${dynamic_trees_version}")
if (dynamic_trees_enable.toBoolean()) {
compileOnly fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-${dynamic_trees_minecraft_version}:${dynamic_trees_version}")
}
// implementation fg.deobf("curse.maven:ic2-classic-242942:4563059")
// implementation fg.deobf("curse.maven:druidcraft-340991:3101903")
// implementation fg.deobf("com.ferreusveritas.dynamictrees:DynamicTrees-1.16.5:0.10.0-Beta25")
// runtimeOnly fg.deobf("vazkii.arl:AutoRegLib:1.4-35.69")
// runtimeOnly fg.deobf("vazkii.quark:Quark:r2.0-212.984")
// runtimeOnly fg.deobf("slimeknights.mantle:Mantle:1.16.5-1.6.115")

View file

@ -33,6 +33,10 @@ cc_tweaked_enable = true
cc_tweaked_minecraft_version = 1.18.2
cc_tweaked_version = 1.100.10
dynamic_trees_enable = true
dynamic_trees_minecraft_version = 1.18.2
dynamic_trees_version = 1.0.4
# curseforge information
projectId = 328085
curse_type = beta

View file

@ -4,32 +4,36 @@ import java.util.function.BiConsumer;
import javax.annotation.Nullable;
import com.ferreusveritas.dynamictrees.api.TreeHelper;
import com.ferreusveritas.dynamictrees.block.branch.BranchBlock;
import com.ferreusveritas.dynamictrees.block.branch.TrunkShellBlock;
import com.ferreusveritas.dynamictrees.util.BranchDestructionData;
import com.simibubi.create.foundation.utility.AbstractBlockBreakQueue;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;
// Commented until dynamic trees are updated
public class DynamicTree extends AbstractBlockBreakQueue {
// private BlockPos startCutPos;
private BlockPos startCutPos;
public DynamicTree(BlockPos startCutPos) {
// this.startCutPos = startCutPos;
}
public static boolean isDynamicBranch(Block block) {
return false; // TreeHelper.isBranch(block) || block instanceof TrunkShellBlock;
this.startCutPos = startCutPos;
}
public static boolean isDynamicBranch(Block block) {
return TreeHelper.isBranch(block) || block instanceof TrunkShellBlock;
}
@Override
public void destroyBlocks(Level world, ItemStack toDamage, @Nullable Player playerEntity, BiConsumer<BlockPos, ItemStack> drop) {
/*
BranchBlock start = TreeHelper.getBranch(world.getBlockState(startCutPos));
if (start == null) //if start is null, it was not a branch
start = setBranchToShellMuse(world, world.getBlockState(startCutPos)); //we check for a trunk shell instead
@ -39,20 +43,19 @@ public class DynamicTree extends AbstractBlockBreakQueue {
// Play and render block break sound and particles
world.levelEvent(null, 2001, startCutPos, Block.getId(world.getBlockState(startCutPos)));
// Actually breaks the tree
// Actually breaks the tree
BranchDestructionData data = start.destroyBranchFromNode(world, startCutPos, Direction.DOWN, false, playerEntity);
// Feed all the tree drops to drop bi-consumer
data.leavesDrops.forEach(stackPos -> drop.accept(stackPos.pos.offset(startCutPos), stackPos.stack));
start.getLogDrops(world, startCutPos, data.species, data.woodVolume).forEach(stack -> drop.accept(startCutPos, stack));
*/
start.getFamily().getCommonSpecies().getBranchesDrops(world, data.woodVolume).forEach(stack -> drop.accept(startCutPos, stack));
}
/*
private BranchBlock setBranchToShellMuse(World world, BlockState state) {
private BranchBlock setBranchToShellMuse(Level world, BlockState state) {
Block block = state.getBlock();
if (block instanceof TrunkShellBlock){
TrunkShellBlock.ShellMuse muse = ((TrunkShellBlock)block).getMuse(world, startCutPos);
@ -61,10 +64,9 @@ public class DynamicTree extends AbstractBlockBreakQueue {
return TreeHelper.getBranch(muse.state);
}
}
return null;
}
*/
}