Fix serverside crash when sprinting on Infested Leaves

This commit is contained in:
thedarkcolour 2024-04-16 13:10:29 -07:00
parent 174bba9dc0
commit 1125d36e0e
No known key found for this signature in database
GPG Key ID: 86B37B3575FD5976

View File

@ -25,7 +25,6 @@ import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.context.BlockPlaceContext;
import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.Level;
import net.minecraft.world.level.LevelReader;
import net.minecraft.world.level.block.Block;
@ -39,6 +38,9 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.StateDefinition;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.phys.HitResult;
import net.neoforged.api.distmarker.Dist;
import net.neoforged.fml.loading.FMLEnvironment;
import org.jetbrains.annotations.Nullable;
import thedarkcolour.exdeorum.blockentity.InfestedLeavesBlockEntity;
import thedarkcolour.exdeorum.client.RenderUtil;
@ -76,7 +78,6 @@ public class InfestedLeavesBlock extends LeavesBlock implements EntityBlock {
}
}
@Nullable
@Override
public BlockEntity newBlockEntity(BlockPos pos, BlockState state) {
return new InfestedLeavesBlockEntity(pos, state);
@ -101,13 +102,13 @@ public class InfestedLeavesBlock extends LeavesBlock implements EntityBlock {
public void randomTick(BlockState state, ServerLevel level, BlockPos pos, RandomSource random) {
if (decaying(state)) {
// doesn't drop unless crook
//dropResources(state, level, pos);
level.removeBlock(pos, false);
}
}
@Override
public RenderShape getRenderShape(BlockState pState) {
if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) return RenderShape.MODEL;
return (EConfig.CLIENT_SPEC.isLoaded() && EConfig.CLIENT.useFastInfestedLeaves.get()) || RenderUtil.IRIS_ACCESS.areShadersEnabled() ? RenderShape.MODEL : RenderShape.INVISIBLE;
}
}