Merge pull request #22 from futureamnet/master

Added throwable mud balls.
This commit is contained in:
ted 2013-04-04 22:15:38 -07:00
commit 641795495d
4 changed files with 80 additions and 2 deletions

View File

@ -1,7 +1,8 @@
package tdwp_ftw.biomesop;
import net.minecraft.client.renderer.entity.RenderSnowball;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.common.MinecraftForge;
import tdwp_ftw.biomesop.items.projectiles.EntityMudball;
import cpw.mods.fml.client.registry.RenderingRegistry;
public class ClientProxy extends CommonProxy {
@ -12,7 +13,8 @@ public class ClientProxy extends CommonProxy {
MinecraftForgeClient.preloadTexture(ARMOR_MUD2_PNG);
MinecraftForgeClient.preloadTexture(ARMOR_AMETHYST1_PNG);
MinecraftForgeClient.preloadTexture(ARMOR_AMETHYST2_PNG);
RenderingRegistry.registerEntityRenderingHandler(EntityMudball.class, new RenderSnowball(mod_BiomesOPlenty.mudBall));
}
@Override

View File

@ -1,7 +1,12 @@
package tdwp_ftw.biomesop.items;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import tdwp_ftw.biomesop.items.projectiles.EntityMudball;
public class ItemBOP extends Item
{
@ -25,4 +30,23 @@ public class ItemBOP extends Item
else if(boptextureid==7){ iconIndex = iconRegister.registerIcon("BiomesOPlenty:stafftopper"); }
else { iconIndex = iconRegister.registerIcon("BiomesOPlenty:mudball"); }
}
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if (par1ItemStack.isItemEqual(new ItemStack(mod_BiomesOPlenty.mudBall)))
{
if (!par3EntityPlayer.capabilities.isCreativeMode)
{
--par1ItemStack.stackSize;
}
par2World.playSoundAtEntity(par3EntityPlayer, "random.bow", 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
if (!par2World.isRemote)
{
par2World.spawnEntityInWorld(new EntityMudball(par2World, par3EntityPlayer));
}
}
return par1ItemStack;
}
}

View File

@ -0,0 +1,49 @@
package tdwp_ftw.biomesop.items.projectiles;
import tdwp_ftw.biomesop.mod_BiomesOPlenty;
import net.minecraft.client.particle.EntityBreakingFX;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.renderer.RenderEngine;
import net.minecraft.client.renderer.RenderGlobal;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.Item;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;
public class EntityMudball extends EntityThrowable
{
public EntityMudball(World par1World)
{
super(par1World);
}
public EntityMudball(World par1World, EntityLiving par2EntityLiving)
{
super(par1World, par2EntityLiving);
}
public EntityMudball(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
@Override
protected void onImpact(MovingObjectPosition par1MovingObjectPosition) {
if (par1MovingObjectPosition.entityHit != null)
{
par1MovingObjectPosition.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), 1);
}
for (int i = 0; i < 16; ++i)
{
this.worldObj.spawnParticle("splash", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
}
if (!this.worldObj.isRemote)
{
this.setDead();
}
}
}

View File

@ -37,6 +37,7 @@ import tdwp_ftw.biomesop.biomes.*;
import tdwp_ftw.biomesop.blocks.*;
import tdwp_ftw.biomesop.helpers.*;
import tdwp_ftw.biomesop.items.*;
import tdwp_ftw.biomesop.items.projectiles.EntityMudball;
import tdwp_ftw.biomesop.mobs.*;
import tdwp_ftw.biomesop.worldtype.WTBiomesOP;
import cpw.mods.fml.common.FMLCommonHandler;
@ -1906,6 +1907,8 @@ public class mod_BiomesOPlenty
LanguageRegistry.instance().addStringLocalization("entity.BiomesOPlenty.Rosester.name", "en_US", "Rosester");
EntityRegistry.addSpawn(EntityRosester.class, 10, 2, 4, EnumCreatureType.creature, garden);
registerEntityEgg(EntityRosester.class, 14831439, 16756224);
EntityRegistry.registerModEntity(EntityMudball.class, "MudBall", EntityRegistry.findGlobalUniqueEntityId(), this, 80, 3, true);
DimensionManager.registerProviderType(promisedLandDim, WorldProviderPromised.class, false);