package com.yolp900.itsjustacharm.client; import com.yolp900.itsjustacharm.ItsJustaCharm; import com.yolp900.itsjustacharm.client.guis.ModGuiHandler; import com.yolp900.itsjustacharm.client.guis.huds.HudHandler; import com.yolp900.itsjustacharm.client.particles.ModParticle; import com.yolp900.itsjustacharm.client.render.BlockRenderHandler; import com.yolp900.itsjustacharm.client.render.ItemRenderHandler; import com.yolp900.itsjustacharm.client.render.TESRHandler; import com.yolp900.itsjustacharm.common.CommonProxy; import com.yolp900.itsjustacharm.common.events.EventHandler; import com.yolp900.itsjustacharm.common.sounds.ModSounds; import com.yolp900.itsjustacharm.common.sounds.SoundHandler; import com.yolp900.itsjustacharm.reference.LibSounds; import com.yolp900.itsjustacharm.reference.LibTexts; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import org.lwjgl.input.Keyboard; import java.util.List; public class ClientProxy extends CommonProxy { @Override public void preInit(FMLPreInitializationEvent event) { super.preInit(event); BlockRenderHandler.registerModels(); ItemRenderHandler.registerModels(); EventHandler.registerClientEvents(); } @Override public void init(FMLInitializationEvent event) { super.init(event); TESRHandler.registerTESRs(); NetworkRegistry.INSTANCE.registerGuiHandler(ItsJustaCharm.instance, new ModGuiHandler()); HudHandler.init(); } @Override public void postInit(FMLPostInitializationEvent event) { super.postInit(event); } @Override public EntityPlayer getClientPlayer() { return getMinecraft().thePlayer; } @Override public Minecraft getMinecraft() { return Minecraft.getMinecraft(); } @Override public void particle(ModParticle particle) { getMinecraft().effectRenderer.addEffect(particle); } @Override public void playSound(LibSounds sound, World world, EntityPlayer player, double x, double y, double z, double volume, double pitch) { ModSounds event = SoundHandler.getSoundEvent(sound); if (event != null) { world.playSound(player, x, y, z, event.getSoundEvent(), event.getCategory(), (float)volume, (float)pitch); } } @Override public void playSound(LibSounds sound, World world, double x, double y, double z, double volume, double pitch, boolean distanceDelay) { ModSounds event = SoundHandler.getSoundEvent(sound); if (event != null) { world.playSound(x, y, z, event.getSoundEvent(), event.getCategory(), (float)volume, (float)pitch, distanceDelay); } } @Override public void chatMessage(LibTexts.ChatMessages message) { List<String> lines = message.getLinedFormattedText(); for (String line : lines) { getClientPlayer().addChatMessage(new TextComponentString(line)); } } @Override public boolean isPlayerPressingSneak() { return Keyboard.getEventKey() == getMinecraft().gameSettings.keyBindSneak.getKeyCode(); } }