• 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from lKinx »
    Hey, Prowne! My paintball mod is almost complete, but I have two questions left. They are not very difficult to answer, so please help me out.

    1. Which numbers do I edit in my entity to make it shoot straighter without dropping?

    2. What numbers do I edit to change the pellet damage?

    Here is my EntityRedPellets.
    package net.minecraft.src;
    
    import java.util.List;
    import java.util.Random;
    
    public class EntityRedPellets extends Entity
    {
    
        public EntityRedPellets(World world)
        {
            super(world);
            xTile = -1;
            yTile = -1;
            zTile = -1;
            inTile = 0;
            inGround = false;
            arrowShake = 0;
            ticksInAir = 0;
            setSize(0.5F, 0.5F);
        }
    
        public EntityRedPellets(World world, double d, double d1, double d2)
        {
            super(world);
            xTile = -1;
            yTile = -1;
            zTile = -1;
            inTile = 0;
            inGround = false;
            arrowShake = 0;
            ticksInAir = 0;
            setSize(0.5F, 0.5F);
            setPosition(d, d1, d2);
            yOffset = 0.0F;
        }
    
        public EntityRedPellets(World world, EntityLiving entityliving)
        {
            super(world);
            xTile = -1;
            yTile = -1;
            zTile = -1;
            inTile = 0;
            inGround = false;
            arrowShake = 0;
            ticksInAir = 0;
            owner = entityliving;
            setSize(0.5F, 0.5F);
            setLocationAndAngles(entityliving.posX, entityliving.posY + (double)entityliving.getEyeHeight(), entityliving.posZ, entityliving.rotationYaw, entityliving.rotationPitch);
            posX -= MathHelper.cos((rotationYaw / 180F) * 3.141593F) * 0.16F;
            posY -= 0.10000000149011612D;
            posZ -= MathHelper.sin((rotationYaw / 180F) * 3.141593F) * 0.16F;
            setPosition(posX, posY, posZ);
            yOffset = 0.0F;
            motionX = -MathHelper.sin((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F);
            motionZ = MathHelper.cos((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F);
            motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F);
            setArrowHeading(motionX, motionY, motionZ, 1.5F, 1.0F); // THESE TWO FLOATS ARE THE SPEED. Increase the value for a higher speed at which the paintball moves.
        }
    
        protected void entityInit()
        {
        }
    
        public void setArrowHeading(double d, double d1, double d2, float f, 
                float f1)
        {
            float f2 = MathHelper.sqrt_double(d * d + d1 * d1 + d2 * d2);
            d /= f2;
            d1 /= f2;
            d2 /= f2;
            d += rand.nextGaussian() * 0.0074999998323619366D * (double)f1;
            d1 += rand.nextGaussian() * 0.0074999998323619366D * (double)f1;
            d2 += rand.nextGaussian() * 0.0074999998323619366D * (double)f1;
            d *= f;
            d1 *= f;
            d2 *= f;
            motionX = d;
            motionY = d1;
            motionZ = d2;
            float f3 = MathHelper.sqrt_double(d * d + d2 * d2);
            prevRotationYaw = rotationYaw = (float)((Math.atan2(d, d2) * 180D) / 3.1415927410125732D);
            prevRotationPitch = rotationPitch = (float)((Math.atan2(d1, f3) * 180D) / 3.1415927410125732D);
            ticksInGround = 0;
        }
    
        public void setVelocity(double d, double d1, double d2)
        {
            motionX = d;
            motionY = d1;
            motionZ = d2;
            if(prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
            {
                float f = MathHelper.sqrt_double(d * d + d2 * d2);
                prevRotationYaw = rotationYaw = (float)((Math.atan2(d, d2) * 180D) / 3.1415927410125732D);
                prevRotationPitch = rotationPitch = (float)((Math.atan2(d1, f) * 180D) / 3.1415927410125732D);
            }
        }
    
        public void onUpdate()
        {
            super.onUpdate();
            if(prevRotationPitch == 0.0F && prevRotationYaw == 0.0F)
            {
                float f = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
                prevRotationYaw = rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / 3.1415927410125732D);
                prevRotationPitch = rotationPitch = (float)((Math.atan2(motionY, f) * 180D) / 3.1415927410125732D);
            }
            if(arrowShake > 0)
            {
                arrowShake--;
            }
            if(inGround)
            {
                int i = worldObj.getBlockId(xTile, yTile, zTile);
                if(i != inTile)
                {
                    inGround = false;
                    motionX *= rand.nextFloat() * 0.2F;
                    motionY *= rand.nextFloat() * 0.2F;
                    motionZ *= rand.nextFloat() * 0.2F;
                    ticksInGround = 0;
                    ticksInAir = 0;
                } else
                {
                    ticksInGround++;
                    if(ticksInGround == 1200)
                    {
                        setEntityDead();
                    }
                    return;
                }
            } else
            {
                ticksInAir++;
            }
            Vec3D vec3d = Vec3D.createVector(posX, posY, posZ);
            Vec3D vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
            MovingObjectPosition movingobjectposition = worldObj.rayTraceBlocks(vec3d, vec3d1);
            vec3d = Vec3D.createVector(posX, posY, posZ);
            vec3d1 = Vec3D.createVector(posX + motionX, posY + motionY, posZ + motionZ);
            if(movingobjectposition != null)
            {
                vec3d1 = Vec3D.createVector(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord);
            }
            Entity entity = null;
            List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
            double d = 0.0D;
            for(int j = 0; j < list.size(); j++)
            {
                Entity entity1 = (Entity)list.get(j);
                if(!entity1.canBeCollidedWith() || entity1 == owner && ticksInAir < 5)
                {
                    continue;
                }
                float f4 = 0.3F;
                AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f4, f4, f4);
                MovingObjectPosition movingobjectposition1 = axisalignedbb.func_1169_a(vec3d, vec3d1);
                if(movingobjectposition1 == null)
                {
                    continue;
                }
                double d1 = vec3d.distanceTo(movingobjectposition1.hitVec);
                if(d1 < d || d == 0.0D)
                {
                    entity = entity1;
                    d = d1;
                }
            }
    
            if(entity != null)
            {
                movingobjectposition = new MovingObjectPosition(entity);
            }
            if(movingobjectposition != null)
            {
                if(movingobjectposition.entityHit != null)
                {
                    if(movingobjectposition.entityHit.attackEntityFrom(owner, 4)) // THIS "4" IS THE DAMAGE. Minecraft uses a system of 20 health points, so to get the hearts damaged you would divide this number by 2. For example, 4 / 2 = 2 hearts lost.
                    {
                        worldObj.playSoundAtEntity(this, "random.drr", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
                        setEntityDead();
                    } else
                    {
                        motionX *= -0.10000000149011612D;
                        motionY *= -0.10000000149011612D;
                        motionZ *= -0.10000000149011612D;
                        rotationYaw += 180F;
                        prevRotationYaw += 180F;
                        ticksInAir = 0;
                    }
                } else
                {
                    xTile = movingobjectposition.blockX;
                    yTile = movingobjectposition.blockY;
                    zTile = movingobjectposition.blockZ;
                    inTile = worldObj.getBlockId(xTile, yTile, zTile);
                    motionX = (float)(movingobjectposition.hitVec.xCoord - posX);
                    motionY = (float)(movingobjectposition.hitVec.yCoord - posY);
                    motionZ = (float)(movingobjectposition.hitVec.zCoord - posZ);
                    float f1 = MathHelper.sqrt_double(motionX * motionX + motionY * motionY + motionZ * motionZ);
                    posX -= (motionX / (double)f1) * 0.05000000074505806D;
                    posY -= (motionY / (double)f1) * 0.05000000074505806D;
                    posZ -= (motionZ / (double)f1) * 0.05000000074505806D;
                    worldObj.playSoundAtEntity(this, "random.drr", 1.0F, 1.2F / (rand.nextFloat() * 0.2F + 0.9F));
                    inGround = true;
                    arrowShake = 7;
                }
            }
            posX += motionX;
            posY += motionY;
            posZ += motionZ;
            float f2 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
            rotationYaw = (float)((Math.atan2(motionX, motionZ) * 180D) / 3.1415927410125732D);
            for(rotationPitch = (float)((Math.atan2(motionY, f2) * 180D) / 3.1415927410125732D); rotationPitch - prevRotationPitch < -180F; prevRotationPitch -= 360F) { }
            for(; rotationPitch - prevRotationPitch >= 180F; prevRotationPitch += 360F) { }
            for(; rotationYaw - prevRotationYaw < -180F; prevRotationYaw -= 360F) { }
            for(; rotationYaw - prevRotationYaw >= 180F; prevRotationYaw += 360F) { }
            rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
            rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
            float f3 = 0.99F;
            float f5 = 0.03F;
            if(func_27013_ag())
            {
                for(int k = 0; k < 4; k++)
                {
                    float f6 = 0.25F;
                    worldObj.spawnParticle("bubble", posX - motionX * (double)f6, posY - motionY * (double)f6, posZ - motionZ * (double)f6, motionX, motionY, motionZ);
                }
    
                f3 = 0.8F;
            }
            motionX *= f3;
            motionY *= f3;
            motionZ *= f3;
            motionY -= f5;
            setPosition(posX, posY, posZ);
        }
    
        public void writeEntityToNBT(NBTTagCompound nbttagcompound)
        {
            nbttagcompound.setShort("xTile", (short)xTile);
            nbttagcompound.setShort("yTile", (short)yTile);
            nbttagcompound.setShort("zTile", (short)zTile);
            nbttagcompound.setByte("inTile", (byte)inTile);
            nbttagcompound.setByte("shake", (byte)arrowShake);
            nbttagcompound.setByte("inGround", (byte)(inGround ? 1 : 0));
        }
    
        public void readEntityFromNBT(NBTTagCompound nbttagcompound)
        {
            xTile = nbttagcompound.getShort("xTile");
            yTile = nbttagcompound.getShort("yTile");
            zTile = nbttagcompound.getShort("zTile");
            inTile = nbttagcompound.getByte("inTile") & 0xff;
            arrowShake = nbttagcompound.getByte("shake") & 0xff;
            inGround = nbttagcompound.getByte("inGround") == 1;
        }
    
        public void onCollideWithPlayer(EntityPlayer entityplayer)
        {
            if(worldObj.multiplayerWorld)
            {
                return;
            }
            if(inGround && owner == entityplayer && arrowShake <= 0 && entityplayer.inventory.addItemStackToInventory(new ItemStack(mod_Paintball.RedPellets, 1)))
            {
                worldObj.playSoundAtEntity(this, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
                entityplayer.onItemPickup(this, 1);
                setEntityDead();
            }
        }
    
        public float getShadowSize()
        {
            return 0.0F;
        }
    
        private int xTile;
        private int yTile;
        private int zTile;
        private int inTile;
        private boolean inGround;
        public int arrowShake;
        public EntityLiving owner;
        private int ticksInGround;
        private int ticksInAir;
    }


    Here is my ItemPaintballGun if you need it.
    package net.minecraft.src;
    
    import java.util.Random;
    
    public class ItemPaintballGun extends Item
    {
    
        public ItemPaintballGun(int i)
        {
            super(i);
            maxStackSize = 1;
        }
    
       public ItemStack onItemRightClick(ItemStack itemstack, World world, EntityPlayer entityplayer)
        {
            if(entityplayer.inventory.consumeInventoryItem(mod_Paintball.RedPellets.shiftedIndex))
            {
                world.playSoundAtEntity(entityplayer, "random.paintballgun", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
                if(!world.multiplayerWorld)
                {
                    world.entityJoinedWorld(new EntityRedPellets(world, entityplayer));
                }
            }
          
          else{
          if(entityplayer.inventory.consumeInventoryItem(mod_Paintball.BluePellets.shiftedIndex))
            {
                world.playSoundAtEntity(entityplayer, "random.paintballgun", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 0.8F));
                if(!world.multiplayerWorld)
                {
                    world.entityJoinedWorld(new EntityBluePellets(world, entityplayer));
                }
            }
          }
            return itemstack;
        }
    }


    Thanks for the help!

    ~lKinx


    I've edited your code samples, just look for my commented out sections.
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from Mrjoshiemoto »
    Hey when adding gem craft I got this error
    java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
    at java.lang.reflect.Constructor.newInstance(Unknown Source)
    at java.lang.Class.newInstance0(Unknown Source)
    at java.lang.Class.newInstance(Unknown Source)
    at ModLoader.addMod(ModLoader.java:201)
    at ModLoader.readFromClassPath(ModLoader.java:1061)
    at ModLoader.init(ModLoader.java:741)
    at ModLoader.AddAllRenderers(ModLoader.java:120)
    at sd.<init>(sd.java:60)
    at sd.<clinit>(sd.java:9)
    at net.minecraft.client.Minecraft.a(SourceFile:282)
    at net.minecraft.client.Minecraft.run(SourceFile:658)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.IllegalArgumentException: Slot 100 is already occupied by BlockSpikes@7fefa490 when adding BlockSpecialOre@4e1d2b8e
    at to.<init>(SourceFile:243)
    at to.<init>(SourceFile:256)
    at BlockSpecialOre.<init>(BlockSpecialOre.java:13)
    at mod_GemCraft.<clinit>(mod_GemCraft.java:350)
    ... 15 more
    May 3, 2011 5:03:51 PM ModLoader AddAllRenderers
    FINE: Initialized
    I'm ONLY using your mods so you should check the block slots so your not over lapping. I might come back and edit more here. I think even though its compatible with mod loader its not using modloader you might want to try that that way these conflicts will stop happening... or should at least.
    Love teh mod though! :biggrin.gif:


    Quote from PROWNE »

    When I created my mods, we still had the limit of 1-127 block IDs (without using More Block IDs). I made all of these IDs within that range to keep external mods users had to install to a minimum. Because large mods take up many IDs, it is hard to keep other ones compatible without breaching that limit. However, now that we have a 1-255 range, there are a lot more ID slots available, which I haven't yet taken advantage of.


    And all of my mods do use ModLoader, they require it.
    Posted in: Minecraft Mods
  • 0

    posted a message on [WIP]ComputerCraft
    Quote from Intuition »
    Industrial blender:

    Internal Components
    [] :|: []
    :|: :Blue: :|:
    [] :|: []

    :|: = Stick
    :Blue: = Furnace

    Makes Industrial Blender Components :tnt:

    :|: :Iron: :|:
    :Iron: :tnt: :Iron:
    :|: :Iron: :|:

    Makes Industrial Blender


    If we are making this, can someone make the GUI for this?


    I'll tackle the code, I just need the artwork to go along with it.
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from Specie9 »
    Why can I not have more than one of these mods at once? Is there a way to fix this?
    (I'm talking about PROWNE's mods working together, not other mods working with PROWNE's mods.)


    When I created my mods, we still had the limit of 1-127 block IDs (without using More Block IDs). I made all of these IDs within that range to keep external mods users had to install to a minimum. Because large mods take up many IDs, it is hard to keep other ones compatible without breaching that limit. However, now that we have a 1-255 range, there are a lot more ID slots available, which I haven't yet taken advantage of.
    Posted in: Minecraft Mods
  • 0

    posted a message on [WIP]ComputerCraft
    Hmm... I wonder if it's possible to emulate a Java application within Java... Playing Minecraft while playing Minecraft, anyone?
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from mobkilla323 »
    Prowne please help, can you read my post above?


    Have you changed any block IDs? If so, make sure to keep them in the 1-255 range. Line 13 is where the block is initialized and the ID and terrain index sprite is sent back to the main Block class.
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Fixed Light Bulbs, I have no idea how the recipe bug slipped through my radar.

    Quote from IronIngot »
    Could I have the source of Light Bulbs? Have to change the ID of the shard, light bulb item and block to be craftable when I change the IDs in the property file.


    "Have to"? I have no idea why you would need to do this, so no.
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from lKinx »
    Hey, Prowne! I was planning on making a paintball mod and I was wondering how you coded your ballistic knife mod. Mine basically will be the same except it will look different, be crafted differently, and have a farther shooting radius.

    I was wondering if you have any tips on how you made this, because right now I am clueless. :tongue.gif:


    Just take a look at the code for the bow and arrows. The bow works like this: when the player right clicks it checks to see if it's able to "consume" an arrow. If it can, it spawns an arrow entity at the player with the same rotation angles as the player, then takes Vec3D lines to figure out the velocity and flight path. To make that arrow entity (or in your case your fired paintball) you'll have to create two new classes, the entity and the renderer. You can pretty much copy and paste the code from the arrows to do this.

    - PROWNE
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Updated 4 more mods, 3 to go...
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from ryanwe »
    Can you change the ballistic knife sound so it sounds like a ballistic knife thnx
    also when you left click with ballistic knife its 1 hit kill
    Meanwhile love your mods! :SSSS: :SSSS: << they get owned when they sneak up

    diamonds for you :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :Diamond: :DBlock: :DBlock:


    When I was making the ballistic knife mod I tried looking for a sound everywhere, but couldn't find one. I couldn't rip the sound from B.O. because the sound quality was too low and saturated with bullet sound effects as well. Please, if you have a ballistic knife sound effect, send it to me.
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from Joshj5hawk »
    Out of curiosity Prowne, What does it take to update realistcraft?


    Since RealistiCraft modifies so many default class files, I'll have to merge the old code into the new java files.

    Quote from jag272 »
    just found this thread and you've got some very good ideas going here. downloaded and installed the updated 1's and i'll definetely be checking often to see when the others update. once again great ideas here =)


    Thank you :smile.gif:

    Quote from j4ke002 »
    When is RealistiCraft being updated again? I really need it for minecraft, I am trying to make one of the hardest minecraft realities possible lol


    I haven't started on RealistiCraft (I'm going alphabetically), but if you truly need it I'll make it a priority. Expect it later today.

    - PROWNE
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from DaysofDecay »
    Quote from PROWNE »
    Quote from DaysofDecay »
    I love your Mods but I'm installing the updated versions and the read-me doesn't tell me what to do with the PROWNE folder (or I'm missing something extremely obvious), I forgot what I did last time and any help would be appreciated.


    You just put the folder in the jar along with the other class files, sorry for not putting that in the readme.

    Thanks for the help. Also I was wondering, if you have more than one type of arrow in your inventory which one does the bow fire? Thanks again.


    It's a sort of preference system. It'll go through different types in order, down a list. It's too complicated to post the full details here.
    Posted in: Minecraft Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from DaysofDecay »
    I love your Mods but I'm installing the updated versions and the read-me doesn't tell me what to do with the PROWNE folder (or I'm missing something extremely obvious), I forgot what I did last time and any help would be appreciated.


    You just put the folder in the jar along with the other class files, sorry for not putting that in the readme.
    Posted in: Minecraft Mods
  • 0

    posted a message on [WIP]ComputerCraft
    Quote from Intuition »
    Quote from baeshra »
    - massive snip -


    Love it. Everybody agrees on this?


    +1 Support, I like the idea.
    Posted in: Requests / Ideas For Mods
  • 0

    posted a message on [V1.5_01/V1.4_01] PROWNE's Mods [Grenade Launcher!]
    Quote from Fanoffi »
    acording to the thread of mo foodz it is you who started it :smile.gif:
    why is it not included in your collection nor updated? :Pig:


    First question: I haven't bothered to add the link on this thread, I prefer to have my larger, stand-alone mods separate from my smaller ones. Second question: I haven't had the time to.
    Posted in: Minecraft Mods
  • To post a comment, please .