<commit_before>package com.creativemd.littletiles;

import com.creativemd.creativecore.common.config.api.CreativeConfig;
import com.creativemd.creativecore.common.config.api.ICreativeConfig;
import com.creativemd.creativecore.common.config.sync.ConfigSynchronization;
import com.creativemd.littletiles.client.render.cache.RenderingThread;
import com.creativemd.littletiles.common.action.LittleActionException;
import com.creativemd.littletiles.common.config.LittleGamemodeConfig;
import com.creativemd.littletiles.common.item.ItemLittleBag;
import com.creativemd.littletiles.common.item.ItemMultiTiles;
import com.creativemd.littletiles.common.structure.type.premade.LittleStructurePremade;
import com.creativemd.littletiles.common.util.grid.LittleGridContext;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;

public class LittleTilesConfig {
	
	@CreativeConfig(requiresRestart = true)
	public Core core = new Core();
	
	@CreativeConfig
	public General general = new General();
	
	@CreativeConfig
	public LittleGamemodeConfig survival = new LittleGamemodeConfig(true);
	
	@CreativeConfig
	public LittleGamemodeConfig creative = new LittleGamemodeConfig(false);
	
	@CreativeConfig(type = ConfigSynchronization.CLIENT)
	public Building building = new Building();
	
	@CreativeConfig(type = ConfigSynchronization.CLIENT)
	public Rendering rendering = new Rendering();
	
	public LittleGamemodeConfig getConfig(EntityPlayer player) {
		if (player.isCreative())
			return creative;
		return survival;
	}
	
	public boolean isEditLimited(EntityPlayer player) {
		return getConfig(player).limitEditBlocks;
	}
	
	public boolean isPlaceLimited(EntityPlayer player) {
		return getConfig(player).limitPlaceBlocks;
	}
	
	public boolean canEditBlock(EntityPlayer player, IBlockState state, BlockPos pos) {
		return state.getBlock().getHarvestLevel(state) > getConfig(player).harvestLevelBlock;
	}
	
	public boolean isTransparencyRestricted(EntityPlayer player) {
		return getConfig(player).minimumTransparency > 0;
	}
	
	public boolean isTransparencyEnabled(EntityPlayer player) {
		return getConfig(player).minimumTransparency < 255;
	}
	
	public int getMinimumTransparency(EntityPlayer player) {
		if (player.isCreative())
			return 0;
		return survival.minimumTransparency;
	}
	
	public static class General {
		
		@CreativeConfig
		public boolean allowFlowingWater = true;
		@CreativeConfig
		public boolean allowFlowingLava = true;
		
		@CreativeConfig
		public float storagePerPixel = 1;
		
		@CreativeConfig
		public boolean enableBed = true;<commit_msg>Fixed harvest level working in the wrong way around<commit_after>package com.creativemd.littletiles;

import com.creativemd.creativecore.common.config.api.CreativeConfig;
import com.creativemd.creativecore.common.config.api.ICreativeConfig;
import com.creativemd.creativecore.common.config.sync.ConfigSynchronization;
import com.creativemd.littletiles.client.render.cache.RenderingThread;
import com.creativemd.littletiles.common.action.LittleActionException;
import com.creativemd.littletiles.common.config.LittleGamemodeConfig;
import com.creativemd.littletiles.common.item.ItemLittleBag;
import com.creativemd.littletiles.common.item.ItemMultiTiles;
import com.creativemd.littletiles.common.structure.type.premade.LittleStructurePremade;
import com.creativemd.littletiles.common.util.grid.LittleGridContext;

import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.translation.I18n;

public class LittleTilesConfig {
	
	@CreativeConfig(requiresRestart = true)
	public Core core = new Core();
	
	@CreativeConfig
	public General general = new General();
	
	@CreativeConfig
	public LittleGamemodeConfig survival = new LittleGamemodeConfig(true);
	
	@CreativeConfig
	public LittleGamemodeConfig creative = new LittleGamemodeConfig(false);
	
	@CreativeConfig(type = ConfigSynchronization.CLIENT)
	public Building building = new Building();
	
	@CreativeConfig(type = ConfigSynchronization.CLIENT)
	public Rendering rendering = new Rendering();
	
	public LittleGamemodeConfig getConfig(EntityPlayer player) {
		if (player.isCreative())
			return creative;
		return survival;
	}
	
	public boolean isEditLimited(EntityPlayer player) {
		return getConfig(player).limitEditBlocks;
	}
	
	public boolean isPlaceLimited(EntityPlayer player) {
		return getConfig(player).limitPlaceBlocks;
	}
	
	public boolean canEditBlock(EntityPlayer player, IBlockState state, BlockPos pos) {
		return state.getBlock().getHarvestLevel(state) <= getConfig(player).harvestLevelBlock;
	}
	
	public boolean isTransparencyRestricted(EntityPlayer player) {
		return getConfig(player).minimumTransparency > 0;
	}
	
	public boolean isTransparencyEnabled(EntityPlayer player) {
		return getConfig(player).minimumTransparency < 255;
	}
	
	public int getMinimumTransparency(EntityPlayer player) {
		if (player.isCreative())
			return 0;
		return survival.minimumTransparency;
	}
	
	public static class General {
		
		@CreativeConfig
		public boolean allowFlowingWater = true;
		@CreativeConfig
		public boolean allowFlowingLava = true;
		
		@CreativeConfig
		public float storagePerPixel = 1;
		
		@CreativeConfig
		public boolean enableBed = true;
{'fraction_non_alphanumeric': 0.08270120259019427, 'fraction_numerical': 0.0029602220166512487, 'mean_word_length': 6.048239895697523, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1692963', 'n_tokens_mistral': 1739, 'n_tokens_neox': 1589, 'n_words': 313}