Jump to content

ashtonr12

Members
  • Posts

    479
  • Joined

  • Last visited

Posts posted by ashtonr12

  1. did you mean this part?

    public void doRenderRockSnowball(EntityRockSnowball par1EntityRockSnowball, double par2, double par4, double par6, float par8, float par9)
    {
    

    i missed some words there but now it just shoots a white square that does not interact with the world

  2. dunno whats wrong with yours but if i were to do what you wanted it to i would write

    package ashtonsmod.common;
    
    import net.minecraft.block.Block;
    import net.minecraft.block.BlockBreakable;
    import net.minecraft.entity.item.EntityItem;
    import net.minecraft.entity.monster.EntitySheep;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.Item;
    import net.minecraftforge.event.ForgeSubscribe;
    import net.minecraftforge.event.entity.living.LivingDropsEvent;
    import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
    
    public class BatDrops {
    
              public static double rand;
    
              @ForgeSubscribe
              public void onEntityDrop(LivingDropsEvent event) {
                      if (event.source.getDamageType().equals("player")) {
                           rand = Math.random();
                            if (event.entityLiving instanceof EntitySheep) {
                                 if (rand < 1.00d){ 
                                    event.entityLiving.dropItem(ParallelWorlds.RawLambChop.itemID, 3);
                               }
                         }}}
    

  3. ok so i added and followed the tutorials twice but the entity doesnt seem to render, i have it so that its basiccaly exactly the same as a snowball, i think i must have missed a line of code :( whne i right click the RockSnowball is consumed (good) but the entity doesnt show(bab) but when i shoot it at water i can hear it splash (good) so its obvoisely there but not rendering also nothing happens when i shoot it at living entities such as cows.

     

    Main Class;

    EntityRegistry.registerModEntity(EntityRockSnowball.class, "RockSnowball", 2, this , 250, 1, false);
    

    Item Class;

    package ashtonsmod.common;
    
    import net.minecraft.block.Block;
    import net.minecraft.client.renderer.texture.IconRegister;
    import net.minecraft.creativetab.CreativeTabs;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntitySnowball;
    import net.minecraft.item.Item;
    import net.minecraft.item.ItemStack;
    import net.minecraft.world.World;
    
    public class RockSnowball extends Item
    {
        public RockSnowball(int par1)
        {
            super(par1);
            this.maxStackSize = 64;
        }
        
        public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
        {
            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 EntityRockSnowball(par2World, par3EntityPlayer));
            }
    
            return par1ItemStack;
        }
        
        @Override
       	public void updateIcons(IconRegister par1IconRegister)
        {
            this.iconIndex = par1IconRegister.registerIcon("ashtonsmod:RockSnowball");
        }}
    
    

    Entity Class

    package ashtonsmod.common;
    
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.entity.projectile.EntityThrowable;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.world.World;
    
    public class EntityRockSnowball extends EntityThrowable{
    
    public EntityRockSnowball(World par1World) {
      super(par1World);
      // TODO Auto-generated constructor stub
    }
    
    public EntityRockSnowball(World par2World, EntityPlayer par3EntityPlayer) {
      super(par2World,par3EntityPlayer);
    }
    
    @Override
    protected void entityInit() {
    
    }
    
    @Override
    public void readEntityFromNBT(NBTTagCompound nbttagcompound) {
    
    }
    
    @Override
    public void writeEntityToNBT(NBTTagCompound nbttagcompound) {
    
    }
    
    @Override
    protected void onImpact(MovingObjectPosition movingobjectposition) {
      this.setDead();
      
    }
    
    }
    

    Render Class;

    package ashtonsmod.common;
    
    import net.minecraft.client.renderer.Tessellator;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.entity.Entity;
    import net.minecraft.util.Icon;
    
    import org.lwjgl.opengl.GL11;
    import org.lwjgl.opengl.GL12;
    
    public class RenderRockSnowball extends Render
    {
    
    public RenderRockSnowball()
    {
    } 
    
    public void doRenderThrownItem(EntityRockSnowball par1EntityThrownItem, double par2, double par4, double par6, float par8, float par9)
    {
        GL11.glPushMatrix();
        GL11.glTranslatef((float)par2, (float)par4, (float)par6);
        GL11.glEnable(GL12.GL_RESCALE_NORMAL);
        float f2 = 1.0F;
        GL11.glScalef(f2 / 1.0F, f2 / 1.0F, f2 / 1.0F);
        Icon icon = ashtonsmod.RockSnowball.getIconFromDamage(0);
        this.loadTexture("ashtonsmod:RockSnowball");
        Tessellator tessellator = Tessellator.instance;
        float f3 = icon.getMinU();
        float f4 = icon.getMaxU();
        float f5 = icon.getMinV();
        float f6 = icon.getMaxV();
        float f7 = 1.0F;
        float f8 = 0.5F;
        float f9 = 0.25F;
        GL11.glRotatef(180.0F - this.renderManager.playerViewY, 0.0F, 1.0F, 0.0F);
        GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
        tessellator.startDrawingQuads();
        tessellator.setNormal(0.0F, 1.0F, 0.0F);
        tessellator.addVertexWithUV((double)(0.0F - f8), (double)(0.0F - f9), 0.0D, (double)f3, (double)f6);
        tessellator.addVertexWithUV((double)(f7 - f8), (double)(0.0F - f9), 0.0D, (double)f4, (double)f6);
        tessellator.addVertexWithUV((double)(f7 - f8), (double)(1.0F - f9), 0.0D, (double)f4, (double)f5);
        tessellator.addVertexWithUV((double)(0.0F - f8), (double)(1.0F - f9), 0.0D, (double)f3, (double)f5);
        tessellator.draw();
        GL11.glDisable(GL12.GL_RESCALE_NORMAL);
        GL11.glPopMatrix();
    }
    
    /**
    * Actually renders the given argument. This is a synthetic bridge method, always casting down its argument and then
    * handing it off to a worker function which does the actual work. In all probabilty, the class Render is generic
    * (Render<T extends Entity) and this method has signature public void doRender(T entity, double d, double d1,
    * double d2, float f, float f1). But JAD is pre 1.5 so doesn't do that.
    */
    public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
    {
        this.doRenderRockSnowball((EntityRockSnowball)par1Entity, par2, par4, par6, par8, par9);
    }
    
    private void doRenderRockSnowball(EntityRockSnowball par1Entity, double par2,
    	double par4, double par6, float par8, float par9) {
    
    }
    
    }
    

     

    Client Proxy Class;

    package ashtonsmod.client;
    
    import ashtonsmod.common.EntityRockSnowball;
    import ashtonsmod.common.RenderRockSnowball;
    import ashtonsmod.common.RockSnowball;
    import cpw.mods.fml.client.registry.RenderingRegistry;
    import cpw.mods.fml.common.registry.EntityRegistry;
    import net.minecraft.client.renderer.entity.Render;
    import net.minecraft.src.ModLoader;
    import net.minecraftforge.client.MinecraftForgeClient;
    
    public class ClientProxyashtonsmod extends ashtonsmod.common.CommonProxy {
            	 @Override
                 public void registerRenderers() {
                  super.registerRenderers(); 
                     EntityRegistry.registerGlobalEntityID(EntityRockSnowball.class, "RockSnoball", ModLoader.getUniqueEntityId());
                     RenderingRegistry.registerEntityRenderingHandler(EntityRockSnowball.class, new RenderRockSnowball());
            }
            
            public void renderRegistry() {
            }
    }
    

     

    why these problems?

  4. what is BUMP!

    ???

    and what you need to generat ore is a gen class

    package ashtonsmod.common;
    
    import java.util.Random;
    
    import net.minecraft.world.World;
    import net.minecraft.world.chunk.IChunkProvider;
    import net.minecraft.world.gen.feature.WorldGenFlowers;
    import net.minecraft.world.gen.feature.WorldGenMinable;
    import cpw.mods.fml.common.IWorldGenerator;
    
    public class WorldGen implements IWorldGenerator{
        
    private static final int BlockX = 0;
    private int BlockZ;
    
    @Override
    public void generate(Random random, int chunkX, int chunkZ, World world,IChunkProvider chunkGenerator, IChunkProvider chunkProvider){
            
      switch(world.provider.dimensionId){
                case 1:
                    generateNether(world, random, chunkX * 16, chunkZ * 16);
                case 0:
                    generateSurface(world, random, chunkX * 16, chunkZ * 16);
                case -1:
                    generateEnd(world, random, chunkX * 16, chunkZ * 16);
      }  
    }
        
    private void generateNether(World world, Random random, int chunkX, int chunkZ) {
     for(int i = 0; i < 5; i++)
         {
            int xCoord = chunkX + random.nextInt(16);
            int yCoord = random.nextInt(30);
            int zCoord = chunkZ + random.nextInt(16);
            (new WorldGenMinable(mainclass.OreBlock.blockID, MaxVienSize)).generate(world, random, xCoord, yCoord, zCoord);
         }
    }
    
    private void generateEnd(World world, Random random, int chunkX, int chunkZ){
    }
        
    private void generateSurface(World world, Random random, int chunkX,int chunkZ){
    }}
    

    and you need to register it in the main mod class under @INT like so;

    @Init
    public void load(FMLInitializationEvent event)
    {
    	GameRegistry.registerWorldGenerator(worldGen);
    }
    

  5. does anyone know how to add a new plant type, you know when you add a plant you set a type such as beach and this requires the plant to be on dirt sand or grass and have water next to it.

    i know how to specify the conditions of the type and where but i dont know how to add a type because they are listed in a enum list which i cannot extend and i cannot create a new list because it would not be called in the cansustain method.

    package net.minecraftforge.common;
    
    public enum EnumPlantType
    {
        Plains,
        Desert,
        Beach,
        Cave,
        Water,
        Nether,
        Crop
    }
    

     

    the vanilla plat type list.

  6. i dont know much about entity items but i had a good idea for a mod. so my question is,

    Is it possible to make a certain entity item check what block it landed on/is on and then do something?

    eg if a rotten flesh lands on a dirt could i put a block of waste on top of the dirt?

    if you have seen/done this before any help would be great as it sound quite hard to programme this to me and this has to be done without editing base classes as per always :)

    Thankyou!

  7. lika dis

     

    MODBLOCK = new BlockMODBLOCK(603).setUnlocalizedName("BLOCKNAME").setStepSound(Block.soundClothFootstep).setHardness(0.8F).setCreativeTab(CreativeTabs.tabDecorations).setCreativeTab(CreativeTabs.tabBlock);
    

    just add more .setCreativeTab(CreativeTabs.tabBlock)

  8. i have an item which is a shield is there any way to make it so that when i right click it absorbs/reduces more damage than a standard block (like sword blocking?)

     

      protected void damageEntity(DamageSource par1DamageSource, int par2)
        {
            if (!this.isEntityInvulnerable())
            {
                par2 = ForgeHooks.onLivingHurt(this, par1DamageSource, par2);
                if (par2 <= 0)
                {
                    return;
                }
    
                if (!par1DamageSource.isUnblockable() && this.isBlocking())
                {
                    par2 = 1 + par2 >> 1;
                }
    
                par2 = ArmorProperties.ApplyArmor(this, inventory.armorInventory, par1DamageSource, par2);
                if (par2 <= 0)
                {
                    return;
                }
                par2 = this.applyPotionDamageCalculations(par1DamageSource, par2);
                this.addExhaustion(par1DamageSource.getHungerDamage());
                int j = this.getHealth();
                this.setEntityHealth(this.getHealth() - par2);
                this.field_94063_bt.func_94547_a(par1DamageSource, j, par2);
            }
        }
    

     

    i found this code and can see that forge have modified it somehow but i cant understand how to edit it. any help would be great thanks.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.