Skip to content
Open
Show file tree
Hide file tree
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 @@ -4,6 +4,7 @@
import com.dtteam.dynamictrees.tree.species.Species;
import net.minecraft.client.Minecraft;
import net.minecraft.client.color.block.BlockTintSource;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.block.BlockAndTintGetter;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.state.BlockState;
Expand All @@ -16,7 +17,7 @@ public static int getFoliageColor(LeavesProperties leavesProperties, BlockAndTin
return tintSource.colorInWorld(blockState, level, pos);
}

public static int getLeavesColor(Species species, BlockAndTintGetter level, BlockPos pos) {
public static int getLeavesColor(Species species, ClientLevel level, BlockPos pos) {
LeavesProperties properties = species.getLeavesProperties();
BlockState state = properties.getDynamicLeavesState();
return getFoliageColor(properties, level, state, pos);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.math.Axis;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.BlockAndTintGetter;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.core.particles.BlockParticleOption;
Expand Down Expand Up @@ -111,6 +111,7 @@ private Vec3 rotateAroundAxis(Vec3 in, Vec3 axis, double theta){
}

protected void spawnLeavesParticlesWhileFalling(FallingTreeEntity entity, float fallSpeed){
if (!entity.level().isClientSide()) return;
BranchDestructionData data = entity.getDestroyData();
if (data.getAllLeavesWithPos().isEmpty()) return;

Expand All @@ -131,6 +132,7 @@ protected void spawnLeavesParticlesWhileFalling(FallingTreeEntity entity, float
}

protected void flingLeavesParticles(FallingTreeEntity entity, float fallSpeed){
if (!entity.level().isClientSide()) return;
int bounces = getData(entity).bounces;
if (bounces > 1) return;
int maxParticleBlocks = DTConfigs.COMMON.maxFallingTreeLeavesParticles.get();
Expand Down Expand Up @@ -170,7 +172,7 @@ protected void flingLeavesParticles(FallingTreeEntity entity, float fallSpeed){
}

private ParticleOptions getParticle(FallingTreeEntity entity, BlockState leavesState, BlockPos leavesPos){
BlockAndTintGetter level = Minecraft.getInstance().level;
ClientLevel level = Minecraft.getInstance().level;
if (level != null) {
if (leavesState.getBlock() instanceof DynamicLeavesBlock leavesBlock){
LeavesProperties properties = leavesBlock.getLeavesProperties();
Expand Down