/**
* Copyright (c) 22/Feb/2015 Davide Cossu & Matthew Albrecht.
*
* This program is free software; you can redistribute it and/or modify it under
* the terms of the GNU Lesser General Public License as published by the Free
* Software Foundation; either version 3 of the License, or (at your option) any
* later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
* PARTICULAR PURPOSE. See the GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with
* this program; if not, see <http://www.gnu.org/licenses>.
*/
package com.minestellar.moon.proxy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import com.minestellar.utils.world.IMinestellarWorldProvider;
import com.minestellar.core.world.CloudRenderer;
import com.minestellar.moon.world.SkyRendererMoon;
import com.minestellar.moon.world.WorldProviderMoon;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ClientProxyMoon extends CommonProxyMoon {
@Override
public void preInit(FMLPreInitializationEvent event) {
super.preInit(event);
}
@Override
public void init(FMLInitializationEvent event) {
FMLCommonHandler.instance().bus().register(new TickHandlerClient());
super.init(event);
}
@Override
public void postInit(FMLPostInitializationEvent event) {
this.registerTileEntityRenders();
this.registerEntityRenderers();
super.postInit(event);
}
private void registerTileEntityRenders() {
}
private void registerEntityRenderers() {
}
@Override
public void spawnParticle(String string, double x, double y, double z) {
}
public static class TickHandlerClient {
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onClientTick(ClientTickEvent event) {
final Minecraft minecraft = FMLClientHandler.instance().getClient();
final WorldClient world = minecraft.theWorld;
if (world != null) {
if (world.provider instanceof WorldProviderMoon) {
if (world.provider.getSkyRenderer() == null) {
world.provider.setSkyRenderer(new SkyRendererMoon((IMinestellarWorldProvider) world.provider));
}
if (world.provider.getCloudRenderer() == null) {
world.provider.setCloudRenderer(new CloudRenderer());
}
}
}
}
}
}