public class VisualHandler implements ICreativeConfig {
    
    @CreativeConfig
    public boolean enabled = true;
    
    @CreativeConfig
    @CreativeConfig.DecimalRange(max = 1, min = 0)
    public float opacity = 1;
    
    @Override
    public void configured() {
        
    }
    
    public void tick(@Nullable EntityPlayer player) {
        
    }
    
    public boolean isEnabled(@Nullable EntityPlayer player) {
        return enabled && opacity > 0;
    }
    
    @SideOnly(Side.CLIENT)
    public synchronized void playSound(ResourceLocation location) {
        playSound(location, null, 1.0F);
    }
    
    @SideOnly(Side.CLIENT)
    public synchronized void playSound(ResourceLocation location, BlockPos pos) {
        playSound(location, pos, 1.0F);
    }
    
    @SideOnly(Side.CLIENT)
    public synchronized void playSound(ResourceLocation location, float volume) {
        playSound(location, null, volume);
    }
    
    @SideOnly(Side.CLIENT)
    public synchronized void playSound(ResourceLocation location, BlockPos pos, float volume) {
        if (!EVClient.shouldRender())
            return;
        if (pos != null)
            Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1, pos));
        else
            Minecraft.getMinecraft().getSoundHandler().playSound(new PositionedSound(location, SoundCategory.MASTER, volume, 1));
    }
    
    @SideOnly(Side.CLIENT)
    public synchronized void playSoundFadeOut(ResourceLocation location, BlockPos pos, DecimalCurve volume) {
        if (!EVClient.shouldRender())
            return;
        if (pos != null)
            Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, pos, volume));
        else
            Minecraft.getMinecraft().getSoundHandler().playSound(new TickedSound(location, SoundCategory.MASTER, 1, volume));
    }
    
} public class SimpleDifficultyAddon {
	
	public static ThirstHandler thirst;
	public static TemperatureHandler temperature;
	
	public static void load() {
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "simple-thirst"), thirst = new ThirstHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "simple-temperature"), temperature = new TemperatureHandler());
	}
} public class ToughAsNailsAddon {
	
	public static ThirstHandler thirst;
	public static TemperatureHandler temperature;
	
	public static void load() {
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "thirst"), thirst = new ThirstHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "temperature"), temperature = new TemperatureHandler());
	}
	
} public class DeathMessages implements ICreativeConfig {
    
    @CreativeConfig
    public List<String> deathMessages = Arrays
        .asList("Do you really want to respawn? think of it again.", "Life is hard. Deal with it!", "You are dead ... wait you already know that.", "Did I let the stove on...?", "Should have shot back first...", "Yep, that's messed up...", "Rage incomming!", "I think you dropped something.", "Time for a break?");
    
    public boolean enabled = true;
    
    private Random rand = new Random();
    
    public String pickRandomDeathMessage() {
        if (deathMessages.size() == 0)
            return null;
        return deathMessages.get(rand.nextInt(deathMessages.size()));
    }
    
    @Override
    public void configured() {
        
    }
    
} public class EVEvents {
    
    private Field size = ReflectionHelper.findField(Explosion.class, new String[] { "field_77280_f", "size" });
    private Field exploder = ReflectionHelper.findField(Explosion.class, new String[] { "field_77283_e", "exploder" });
    
    @SubscribeEvent
    public void explosion(ExplosionEvent.Detonate event) {
        if (event.getWorld() != null && !event.getWorld().isRemote) {
            try {
                int sourceEntity = -1;
                Entity source = ((Entity) exploder.get(event.getExplosion()));
                if (source != null)
                    sourceEntity = source.getEntityId();
                ExplosionPacket packet = new ExplosionPacket(event.getExplosion().getPosition(), size.getFloat(event.getExplosion()), sourceEntity);
                for (Entity entity : event.getAffectedEntities())
                    if (entity instanceof EntityPlayerMP)
                        PacketHandler.sendPacketToPlayer(packet, (EntityPlayerMP) entity);
            } catch (IllegalArgumentException | IllegalAccessException e) {
                e.printStackTrace();
            }
            
        }
    }
    
    @SubscribeEvent
    public void impact(ProjectileImpactEvent.Throwable event) {
        if (!event.getEntity().world.isRemote && event.getEntity() instanceof EntityPotion && !event.isCanceled()) {
            EntityPotion entity = (EntityPotion) event.getEntity();
            AxisAlignedBB axisalignedbb = entity.getEntityBoundingBox().grow(4.0D, 2.0D, 4.0D);
            List<Entity> list = entity.world.getEntitiesWithinAABBExcludingEntity(entity, axisalignedbb);
            if (!list.isEmpty()) {
                for (Entity livingentity : list) {
                    if (livingentity instanceof EntityLivingBase && ((EntityLivingBase) livingentity).canBeHitWithPotion() && livingentity instanceof EntityPlayer) {
                        double d0 = entity.getDistanceSq(livingentity);
                        if (d0 < 16.0D)
                            PacketHandler.sendPacketToPlayer(new PotionPacket(Math.sqrt(d0), entity.getPotion()), (EntityPlayerMP) livingentity);
                    }
                }
            }
        }
        
    }
    
    @SubscribeEvent
    public void damage(LivingDamageEvent event) {
        if (event.getEntity() instanceof EntityPlayerMP) {
            if (EnhancedVisuals.CONFIG.enableDamageDebug)
                ((EntityPlayerMP) event.getEntity()).sendMessage(new TextComponentString(event.getSource().damageType + "," + event.getSource().getDeathMessage(event.getEntityLiving())
                    .getUnformattedText() + "," + event.getAmount()));
            PacketHandler.sendPacketToPlayer(new DamagePacket(event), (EntityPlayerMP) event.getEntity());
        }
    }
    
    @SubscribeEvent
    @SideOnly(Side.CLIENT)
    public void clientTick(ClientTickEvent event) {
        if (event.phase == Phase.START && EVClient.shouldTick()) {
            EntityPlayer player = Minecraft.getMinecraft().player;
            VisualManager.onTick(player);
            
            SoundMuteHandler.tick();
        }
    }
    
    public static boolean areEyesInWater(EntityPlayer player) {
        return player.isInsideOfMaterial(Material.WATER);
    }
} public class VisualHandlers {
	
	public static ExplosionHandler EXPLOSION;
	public static PotionHandler POTION;
	
	public static SandSplatHandler SAND;
	public static SplashHandler SPLASH;
	public static DamageHandler DAMAGE;
	
	public static SlenderHandler SLENDER;
	public static SaturationHandler SATURATION;
	public static HeartbeatHandler HEARTBEAT;
	
	public static void init() {
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "explosion"), EXPLOSION = new ExplosionHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "potion"), POTION = new PotionHandler());
		
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "sand"), SAND = new SandSplatHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "splash"), SPLASH = new SplashHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "damage"), DAMAGE = new DamageHandler());
		
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "slender"), SLENDER = new SlenderHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "saturation"), SATURATION = new SaturationHandler());
		VisualRegistry.registerHandler(new ResourceLocation(EnhancedVisuals.MODID, "heartbeat"), HEARTBEAT = new HeartbeatHandler());
	}
	
} public class DamagePacket extends CreativeCorePacket {
    
    public String attackerClass;
    public ItemStack stack;
    public float damage;
    
    public float distance;
    public boolean fire;
    public String source;
    
    public DamagePacket(LivingDamageEvent event) {
        this.damage = event.getAmount();
        Entity attacker = event.getSource().getImmediateSource();
        this.fire = event.getSource().isFireDamage();
        if (attacker instanceof EntityLiving || attacker instanceof EntityArrow) {
            attackerClass = attacker.getClass().getName().toLowerCase();
            this.source = "attacker";
            
            if (attacker instanceof EntityLiving && ((EntityLiving) attacker).getHeldItemMainhand() != null)
                stack = ((EntityLiving) attacker).getHeldItemMainhand();
            
        } else
            this.source = event.getSource().damageType;
    }
    
    public DamagePacket() {
        
    }
    
    @Override
    public void writeBytes(ByteBuf buf) {
        if (attackerClass != null) {
            buf.writeBoolean(true);
            writeString(buf, attackerClass);
        } else
            buf.writeBoolean(false);
        
        if (stack != null) {
            buf.writeBoolean(true);
            writeItemStack(buf, stack);
        } else
            buf.writeBoolean(false);
        
        buf.writeFloat(damage);
        buf.writeFloat(distance);
        writeString(buf, source);
        buf.writeBoolean(fire);
    }
    
    @Override
    public void readBytes(ByteBuf buf) {
        if (buf.readBoolean())
            attackerClass = readString(buf);
        if (buf.readBoolean())
            stack = readItemStack(buf);
        damage = buf.readFloat();
        distance = buf.readFloat();
        source = readString(buf);
        fire = buf.readBoolean();
    }
    
    @Override
    public void executeClient(EntityPlayer player) {
        if (VisualHandlers.DAMAGE.isEnabled(player))
            VisualHandlers.DAMAGE.playerDamaged(player, this);
    }
    
    @Override
    public void executeServer(EntityPlayer player) {
        
    }
    
} public class ExplosionPacket extends CreativeCorePacket {
	
	public Vec3d pos;
	public float size;
	public int sourceEntity;
	
	public ExplosionPacket(Vec3d pos, float size, int sourceEntity) {
		this.pos = pos;
		this.size = size;
		this.sourceEntity = sourceEntity;
	}
	
	public ExplosionPacket() {
		
	}
	
	@Override
	public void writeBytes(ByteBuf buf) {
		writeVec3d(pos, buf);
		buf.writeFloat(size);
		buf.writeInt(sourceEntity);
	}
	
	@Override
	public void readBytes(ByteBuf buf) {
		pos = readVec3d(buf);
		size = buf.readFloat();
		sourceEntity = buf.readInt();
	}
	
	@Override
	public void executeClient(EntityPlayer player) {
		if (VisualHandlers.EXPLOSION.isEnabled(player))
			VisualHandlers.EXPLOSION.onExploded(player, pos, size, player.world.getEntityByID(sourceEntity));
	}
	
	@Override
	public void executeServer(EntityPlayer player) {
		
	}
	
} public class PotionPacket extends CreativeCorePacket {
	
	public double distance;
	public ItemStack stack;
	
	public PotionPacket() {
		
	}
	
	public PotionPacket(double distance, ItemStack stack) {
		this.distance = distance;
		this.stack = stack;
	}
	
	@Override
	public void writeBytes(ByteBuf buf) {
		buf.writeDouble(distance);
		writeItemStack(buf, stack);
	}
	
	@Override
	public void readBytes(ByteBuf buf) {
		distance = buf.readDouble();
		stack = readItemStack(buf);
	}
	
	@Override
	public void executeClient(EntityPlayer player) {
		if (VisualHandlers.POTION.isEnabled(player))
			VisualHandlers.POTION.impact(distance, stack);
	}
	
	@Override
	public void executeServer(EntityPlayer player) {
		
	}
} public class VisualRegistry {
	
	private static LinkedHashMap<ResourceLocation, VisualHandler> handlers = new LinkedHashMap<>();
	
	public static void registerHandler(ResourceLocation location, VisualHandler handler) {
		handlers.put(location, handler);
	}
	
	public static Collection<VisualHandler> handlers() {
		return handlers.values();
	}
	
	public static Set<Entry<ResourceLocation, VisualHandler>> entrySet() {
		return handlers.entrySet();
	}
	
} public class EVServer {
	
	public void load(FMLInitializationEvent event) {
		
	}
}
import java.util.Map.Entry;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import com.creativemd.creativecore.common.config.holder.ConfigHolderDynamic;
import com.creativemd.creativecore.common.config.holder.CreativeConfigRegistry;
import com.creativemd.creativecore.common.config.sync.ConfigSynchronization;
import com.creativemd.creativecore.common.packet.CreativeCorePacket;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.SidedProxy;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import team.creative.enhancedvisuals.api.VisualHandler;
import team.creative.enhancedvisuals.common.addon.simpledifficulty.SimpleDifficultyAddon;
import team.creative.enhancedvisuals.common.addon.toughasnails.ToughAsNailsAddon;
import team.creative.enhancedvisuals.common.death.DeathMessages;
import team.creative.enhancedvisuals.common.event.EVEvents;
import team.creative.enhancedvisuals.common.handler.VisualHandlers;
import team.creative.enhancedvisuals.common.packet.DamagePacket;
import team.creative.enhancedvisuals.common.packet.ExplosionPacket;
import team.creative.enhancedvisuals.common.packet.PotionPacket;
import team.creative.enhancedvisuals.common.visual.VisualRegistry;
import team.creative.enhancedvisuals.server.EVServer;
package team.creative.enhancedvisuals;





@Mod(modid = EnhancedVisuals.MODID, name = EnhancedVisuals.NAME, version = EnhancedVisuals.VERSION, acceptedMinecraftVersions = "", dependencies = "required-after:creativecore", guiFactory = "team.creative.enhancedvisuals.client.EVSettings")
public class EnhancedVisuals {
	
	public static final String MODID = "enhancedvisuals";
	public static final String NAME = "Enhanced Visuals";
	public static final String VERSION = "1.3.0";
	
	public static final Logger LOGGER = LogManager.getLogger(EnhancedVisuals.MODID);
	public static EVEvents EVENTS;
	public static DeathMessages MESSAGES;
	public static EnhancedVisualsConfig CONFIG;
	
	@SidedProxy(clientSide = "team.creative.enhancedvisuals.client.EVClient", serverSide = "team.creative.enhancedvisuals.server.EVServer")
	public static EVServer proxy;