BiomesOPlenty/common/biomesoplenty/ClientProxy.java

156 lines
5.6 KiB
Java
Raw Normal View History

2013-05-03 13:00:44 +00:00
package biomesoplenty;
2013-11-17 01:18:19 +00:00
import java.util.Random;
2013-05-03 13:00:44 +00:00
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelChicken;
import net.minecraft.client.model.ModelSlime;
2013-05-03 13:00:44 +00:00
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.entity.RenderSnowball;
2013-11-17 01:18:19 +00:00
import net.minecraft.util.MathHelper;
2013-05-03 13:00:44 +00:00
import biomesoplenty.api.Items;
2013-09-24 07:53:43 +00:00
import biomesoplenty.blocks.renderers.BambooRenderer;
2013-05-03 13:00:44 +00:00
import biomesoplenty.blocks.renderers.FoliageRenderer;
2013-07-09 21:05:03 +00:00
import biomesoplenty.blocks.renderers.GraveRenderer;
2013-05-03 13:00:44 +00:00
import biomesoplenty.blocks.renderers.PlantsRenderer;
import biomesoplenty.blocks.renderers.PuddleRender;
import biomesoplenty.blocks.renderers.RenderUtils;
import biomesoplenty.blocks.renderers.SmallBlockRenderer;
2013-10-11 14:28:13 +00:00
import biomesoplenty.configuration.configfile.BOPConfigurationIDs;
2013-11-08 03:16:32 +00:00
import biomesoplenty.entities.EntityBird;
import biomesoplenty.entities.EntityGlob;
import biomesoplenty.entities.EntityJungleSpider;
2013-08-30 11:38:54 +00:00
import biomesoplenty.entities.EntityPhantom;
2013-11-16 12:50:29 +00:00
import biomesoplenty.entities.EntityPixie;
import biomesoplenty.entities.EntityRosester;
import biomesoplenty.entities.EntityWasp;
2013-07-03 07:51:39 +00:00
import biomesoplenty.entities.projectiles.EntityDart;
import biomesoplenty.entities.projectiles.EntityMudball;
2013-11-08 03:16:32 +00:00
import biomesoplenty.entities.render.RenderBird;
2013-07-03 07:51:39 +00:00
import biomesoplenty.entities.render.RenderDart;
import biomesoplenty.entities.render.RenderGlob;
import biomesoplenty.entities.render.RenderJungleSpider;
2013-08-30 11:38:54 +00:00
import biomesoplenty.entities.render.RenderPhantom;
2013-11-16 12:50:29 +00:00
import biomesoplenty.entities.render.RenderPixie;
import biomesoplenty.entities.render.RenderRosester;
import biomesoplenty.entities.render.RenderWasp;
import biomesoplenty.particles.EntityDandelionFX;
import biomesoplenty.particles.EntityMagicTreeFX;
import biomesoplenty.particles.EntityPixieTrailFX;
import biomesoplenty.particles.EntitySteamFX;
2013-05-03 13:00:44 +00:00
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxy extends CommonProxy {
2013-05-31 10:34:02 +00:00
public static Minecraft mc = Minecraft.getMinecraft();
public static int puddleRenderPass;
2013-05-03 13:00:44 +00:00
@Override
2013-05-31 10:34:02 +00:00
public void registerRenderers()
2013-05-03 13:00:44 +00:00
{
2013-07-09 21:05:03 +00:00
RenderUtils.foliageModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.plantsModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.puddleModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.bonesModel = RenderingRegistry.getNextAvailableRenderId();
RenderUtils.graveModel = RenderingRegistry.getNextAvailableRenderId();
2013-09-24 07:53:43 +00:00
RenderUtils.bambooModel = RenderingRegistry.getNextAvailableRenderId();
2013-05-31 10:34:02 +00:00
RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(Items.mudball.get(), 0));
RenderingRegistry.registerEntityRenderingHandler(EntityDart.class, new RenderDart());
2013-10-11 14:28:13 +00:00
if (BOPConfigurationIDs.globID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityGlob.class, new RenderGlob(new ModelSlime(16), new ModelSlime(0), 0.25F));
}
if (BOPConfigurationIDs.jungleSpiderID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityJungleSpider.class, new RenderJungleSpider());
}
if (BOPConfigurationIDs.rosesterID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityRosester.class, new RenderRosester(new ModelChicken(), 0.3F));
}
if (BOPConfigurationIDs.phantomID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityPhantom.class, new RenderPhantom());
}
2013-05-31 10:34:02 +00:00
if (BOPConfigurationIDs.waspID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityWasp.class, new RenderWasp());
}
2013-11-08 03:16:32 +00:00
if (BOPConfigurationIDs.birdID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityBird.class, new RenderBird());
}
2013-11-16 12:50:29 +00:00
if (BOPConfigurationIDs.pixieID > 0)
{
RenderingRegistry.registerEntityRenderingHandler(EntityPixie.class, new RenderPixie());
}
2013-05-03 13:00:44 +00:00
RenderingRegistry.registerBlockHandler(new FoliageRenderer());
RenderingRegistry.registerBlockHandler(new PlantsRenderer());
RenderingRegistry.registerBlockHandler(new SmallBlockRenderer());
RenderingRegistry.registerBlockHandler(new PuddleRender());
2013-07-09 21:05:03 +00:00
RenderingRegistry.registerBlockHandler(new GraveRenderer());
2013-09-24 07:53:43 +00:00
RenderingRegistry.registerBlockHandler(new BambooRenderer());
2013-05-03 13:00:44 +00:00
}
2013-05-31 10:34:02 +00:00
2013-05-11 12:51:16 +00:00
@Override
2013-05-13 08:20:06 +00:00
public void spawnParticle(String string, double x, double y, double z)
2013-05-11 12:51:16 +00:00
{
2013-05-31 10:34:02 +00:00
EntityFX entityfx = null;
2013-11-17 01:18:19 +00:00
Random rand = new Random();
2013-05-31 10:34:02 +00:00
if (string == "mud")
{
entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.mudball.get());
}
else if (string == "dart")
{
entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.dart.get(), 0);
}
else if (string == "poisondart")
{
entityfx = new EntityBreakingFX(mc.theWorld, x, y, z, Items.dart.get(), 1);
}
else if (string == "dandelion")
{
2013-05-31 10:34:02 +00:00
entityfx = new EntityDandelionFX(mc.theWorld, x, y, z, 2.0F);
}
else if (string == "steam")
{
2013-05-31 10:34:02 +00:00
entityfx = new EntitySteamFX(mc.theWorld, x, y, z, 0.0D, 0.0D, 0.0D);
}
else if (string == "magictree")
{
2013-11-17 01:18:19 +00:00
entityfx = new EntityMagicTreeFX(mc.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
}
else if (string == "pixietrail")
{
entityfx = new EntityPixieTrailFX(mc.theWorld, x, y, z, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03), -0.02D, MathHelper.getRandomDoubleInRange(rand, -0.03, 0.03));
}
2013-05-31 10:34:02 +00:00
mc.effectRenderer.addEffect(entityfx);
2013-05-31 10:34:02 +00:00
}
2013-11-17 01:18:19 +00:00
public static double generatRandomPositiveNegitiveValue(double max, double min)
{
Random rand = new Random();
double d = -min + (Math.random() * ((max - (-min)) + 1));
return d;
}
2013-05-03 13:00:44 +00:00
@Override
public int addArmor(String armor)
{
return RenderingRegistry.addNewArmourRendererPrefix(armor);
}
}