Jump to content

TuxCraft

Members
  • Posts

    92
  • Joined

  • Last visited

Posts posted by TuxCraft

  1. Oh and I should probably add for future generations that this did have a happy ending. I fixed my problem. I'm running on a Mac and when I try to compress a folder it adds all sorts of invisible files and metadata. However when I select all the files and compress them instead of the folder it bypasses the metadata. Look foward to seeing my mod released soon!

  2. Do you have a direct link to the texture? e.g. /mods/modName/textures/etc. Because that can change when you move from eclipse to the actual mine craft running environment. My advice is to put this...

    new File("GoofyGoober").mkdir();
    

    Somewhere in your render code. When minecraft runs it will make the folder "GoofyGoober", compare that folder location to when you run it in eclipse and when you run it in the tekkit-lite instance. If they are in different locations you need to change the file path.

     

    Also just check that the texture is in the right folder. Sometimes it could just be as derpy as that.

  3. I use

            @SideOnly(Side.CLIENT)
    public int getColorFromItemStack(ItemStack par1ItemStack, int par2)
    {
    	return colorA;
    }
    

     

    Where colorA is the same color as html except with a 0x in front of it.

    e.g. go here and pick a color. Copy the selected color box (#CCCCFF) take out the hashtag and add in a 0x (0xCCCCFF).

     

    Then just make it random. If you want to do multiple colors you'll have to make multiple renders and then check which render it is in the getColor method.

  4. After the release I'm perfectly fine with you looking at the jar, it's just pre-release when it's vulnerable. I don't have any copyrights or any lawyers so if you just took it pre-release no one would know or be able to fight it. Post-release yes there will be people who try to take it and redistribute it but at least then I'll have a page to prove that I am the original author. Also with numerous references to my name in the code it won't be hard to prove that I am the owner of the mod, and I will be able to take legal action against all who try and rip me off.

     

    Look, I trust people on the internet to an extent. You made an analogy to a circuit board, that does not apply even remotely to this situation. First off if you were having troubles and you went onto the internet to see if you could get your problem solved it would much harder to give your questioner your circuit board. If you had a problem with a circuit board you would take it to someone who was knowledgeable about this kind of thing in your area, and if your smart you'll watch him as he fixes your problem to A find out what's wrong and how to fix it, and B make sure he doesn't steal it. After I send you or anyone my jar I have no way to know what you are doing with it, and that scares me. Sure I could go by word of mouth, but that simply isn't enough for me. And by the way ObsequiousNewt, don't fool yourself, you were the one who started this argument. You were the one who felt it was so important to uphold your "honor" after I politely declined to give you my mod. Read back, open your eyes, while I simply wanted to protect what was mine you wanted to turn this into a flame war. YOU started this, never forget. You are the CEO of Pentachoron Labs, it says so in your description. If you are planning to make any money I advise you strongly to not post all of your work on github before release. You're a complete idiot for posting all your code on github pre-release. It's not like it's hard to find either! I searched Pentachoron Labs on google and that link was the first that showed up. Not only that but you have the name in your signature. What if some scumbag who has been browsing the forums sees you and does a little research on your little Pentachoron Labs and steals all your source. I'm assuming if you're a CEO you're company plans to make money, I'm telling you right now that is the WORST business plan I have ever heard. Justify your actions, I dare you. Justify going after a small developer who doesn't want to be a victim of internet theft, I challenge you. Justify what moral cause you think you have in pursuing this argument. You talk about honor, what you have is not honor, it is pride.

     

    Btw, I like the like the laws of flame.  :P

  5. Okay, what's the big deal? I try to protect my code from potential scumbags and you blow up in my face? What's wrong with wanting to keep your hard work safe? By the way you're responding you are truly leading me to believe you want my code for the wrong reasons, why else would you fight a budding young developer for what he believes is right? If you were in my situation would you trust some random guy on the internet, which by the way is the best place in the world to lie and get away with it, with your months of hard work? Now, you can make the argument that your code would be superior to mine because you have had more modding experience then I. Well I strongly disagree with that, just because the code might be better doesn't mean the content is, it doesn't mean the textures are worse, it doesn't mean the models are worse, my mod is a lot more than a simple spear. You have made the argument that you couldn't do anything without the source, I'm sorry to tell you but java decompilers do exist, do a quick search on google and you'll find them. If the computer can decompile, a program can too, the logic is that simple. For anything one piece of software can do, another can undo, that is one of the beauties, and dangers of computers. This isn't about, "It would take more work to incorporate your mod into mine" that is completely dependent on the situation and as I said before you are a complete stranger to me, I don't know you, I don't know your situation you could be anyone doing anything.  You said you can solve my problem with screenshots? Ask for them, do not ask for months of hard work that is vulnerable because it has not yet been released. Every part of that jar is an asset and some you wouldn't even need a decompiler to take and exploit.

     

    I never attacked you or your open-source coder law so why are you defending yourself? You are taking this way to personally. I respect you and everyone who answers questions here on the forums even if they openly disagree with a mod and that won't change, you put up with a lot of noobs here and don't get thanked enough for what you do, but even so there are some things I will not give you when you try to help me. Because there are bad people out there and I don't want to run the risk of being a victim of any of there shenanigans. I will give you a few pieces and parts that I feel are causing me trouble, but I will not give you everything.

     

    I have given you my screenshots in a previous post if you'd still like to answer my question.

  6. You've most likely got the mod files in a subfolder in the .zip file at a guess.

    If you could give us some idea of the structure of the files in the zip (so much as a screenshot would be good) then we might be able to give some more help.

     

    This is how it is the minecraft mods folder.

     

    b8928225amrwa.png

     

     

    And here's the mcp folder screenshot, just in case you need that too.

     

    8719b2e7eexu6.png

     

  7. I don't believe your a bad person I just simply don't know you so call me paranoid if you'd like, I just don't want to run the risk of putting my trust in the wrong person. If you know what's wrong or what might be wrong please answer, if not, or if you don't feel like helping serious developers move on.

     

    Also a little more insight on my problem. When I run reobfuscate.sh instead of reobfuscate_srg.sh it still works in the normal folder format but when I zip it or jar it it crashes with some class not found error, however all the classes are there I double checked and triple checked. I'm on a mac, may that be my problem? Btw I have no base edits so that's why I used the _srg instead of the normal one.

  8. Could I have a copy of the zip/jar that fails?

     

    Nothing personal but I've worked long and hard on my mod and I'm not sure I'm ready to just give it away to a total stranger on the internet. I will however tell you anything you'd like to know about the structure and files.

     

    Also I know why the mcmod.info file didn't work, there was an error in the syntax.

  9. I recompiled and reobfuscated my mod and put it in the minecraft mod folder with forge installed and it works fine. But when I try and put it in the .zip format or .jar format it doesn't load in forge, it doesn't crash it just simply doesn't show up.

     

    Also when I put an mcmod.info file in the non zipped version that works it says I still don't have a mcmod.info file, help!

  10. That doesn't work if I'm just trying to get the item not itemstack. I tried new ItemStack(Item.itemList[theID]).getItem() and Item.itemList[theID], but neither worked. Also its "itemsList" not itemList.

  11. Someone please help I can tell packets are very important and I'll need to know how to use them sooner or later. If you could even link me to a tutorial or an open source mod that is a good example that would be great.

  12. ok if it's not showing try scrapping the if(world.isRemote) completely. See what that does, I'm to too familiar with entities, it's been a while since I've done stuff with them and i don't have the files anymore :(

     

    still don't know about the other one

     

    Nope that doesn't work either. I'm pretty convinced that I need to send packets from the client to the server in order to do what I want but I have no idea how.

  13. Ok I made HUGE changes to the harpoon code and I'm not sure what exactly you changed, it looks like you took out the 'if(par2World.isRemote)' at the top and moved it to only be above the spawn entity in world bit. When I tried those two changes the projectile briefly flashed in the corner of my screen and then disappeared. I believe you meant to have the exclamation mark before par2World because when I did that it did damage to enemies I aimed at but I couldn't see it, probably a problem with my rendering, should be a simple fix (However if you have any insight do share  ;D).

     

    Anyway here's my whole EntitySpear code because I really want this fixed.

    I still believe I need to use a packet but I'm not sure how.

     

    package TuxWeapons.TuxCraft;
    
    import java.util.Iterator;
    import java.util.List;
    
    import net.minecraft.block.Block;
    import net.minecraft.entity.Entity;
    import net.minecraft.entity.EntityLiving;
    import net.minecraft.entity.IProjectile;
    import net.minecraft.entity.player.EntityPlayer;
    import net.minecraft.item.ItemStack;
    import net.minecraft.nbt.NBTTagCompound;
    import net.minecraft.util.AxisAlignedBB;
    import net.minecraft.util.DamageSource;
    import net.minecraft.util.MathHelper;
    import net.minecraft.util.MovingObjectPosition;
    import net.minecraft.util.Vec3;
    import net.minecraft.world.World;
    import cpw.mods.fml.relauncher.Side;
    import cpw.mods.fml.relauncher.SideOnly;
    
    public class EntitySpear extends Entity implements IProjectile
    {
    
    private int xTile = -1;
    private int yTile = -1;
    private int zTile = -1;
    private int inTile = 0;
    private int inData = 0;
    private boolean inGround = false;
    private ItemStack stack;
    
    /** 1 if the player can pick up the arrow */
    public int canBePickedUp = 0;
    
    /** Seems to be some sort of timer for animating an arrow. */
    public int arrowShake = 0;
    
    /** The owner of this arrow. */
    public Entity owner;
    private int ticksInGround;
    private int ticksInAir = 0;
    private double damage = 2.0D;
    
    /** The amount of knockback an arrow applies when it hits a mob. */
    private int knockbackStrength;
    
    public EntitySpear(World par1World)
    {
    
    	super(par1World);
    	this.setSize(0.5F, 0.5F);
    }
    
    public EntitySpear(World par1World, double par2, double par4, double par6)
    {
    
    	super(par1World);
    	this.setSize(0.5F, 0.5F);
    	this.setPosition(par2, par4, par6);
    	this.yOffset = 0.0F;
    }
    
    public EntitySpear(World par1World, EntityLiving par2EntityLiving,
            EntityLiving par3EntityLiving, float par4, float par5)
    {
    
    	super(par1World);
    	this.owner = par2EntityLiving;
    
    	if (par2EntityLiving instanceof EntityPlayer)
    	{
    		this.canBePickedUp = 1;
    	}
    
    	this.posY = par2EntityLiving.posY + par2EntityLiving.getEyeHeight()
    	        - 0.10000000149011612D;
    	double var6 = par3EntityLiving.posX - par2EntityLiving.posX;
    	double var8 = par3EntityLiving.posY + par3EntityLiving.getEyeHeight()
    	        - 0.699999988079071D - this.posY;
    	double var10 = par3EntityLiving.posZ - par2EntityLiving.posZ;
    	double var12 = MathHelper.sqrt_double(var6 * var6 + var10 * var10);
    
    	if (var12 >= 1.0E-7D)
    	{
    		float var14 = (float) (Math.atan2(var10, var6) * 180.0D / Math.PI) - 90.0F;
    		float var15 = (float) -(Math.atan2(var8, var12) * 180.0D / Math.PI);
    		double var16 = var6 / var12;
    		double var18 = var10 / var12;
    		this.setLocationAndAngles(par2EntityLiving.posX + var16, this.posY,
    		        par2EntityLiving.posZ + var18, var14, var15);
    		this.yOffset = 0.0F;
    		float var20 = (float) var12 * 0.2F;
    		this.setThrowableHeading(var6, var8 + var20, var10, par4, par5);
    	}
    }
    
    public EntitySpear(World par1World, EntityLiving par2EntityLiving,
            float par3, ItemStack par4ItemStack)
    {
    
    	super(par1World);
    	this.owner = par2EntityLiving;
    	this.stack = par4ItemStack;
    
    	if (par2EntityLiving instanceof EntityPlayer)
    	{
    		this.canBePickedUp = 1;
    	}
    
    	this.setSize(0.5F, 0.5F);
    	this.setLocationAndAngles(par2EntityLiving.posX, par2EntityLiving.posY
    	        + par2EntityLiving.getEyeHeight(), par2EntityLiving.posZ,
    	        par2EntityLiving.rotationYaw, par2EntityLiving.rotationPitch);
    	this.posX -= MathHelper
    	        .cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
    	this.posY -= 0.10000000149011612D;
    	this.posZ -= MathHelper
    	        .sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
    	this.setPosition(this.posX, this.posY, this.posZ);
    	this.yOffset = 0.0F;
    	this.motionX = -MathHelper.sin(this.rotationYaw / 180.0F
    	        * (float) Math.PI)
    	        * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    	this.motionZ = MathHelper.cos(this.rotationYaw / 180.0F
    	        * (float) Math.PI)
    	        * MathHelper.cos(this.rotationPitch / 180.0F * (float) Math.PI);
    	this.motionY = -MathHelper.sin(this.rotationPitch / 180.0F
    	        * (float) Math.PI);
    	this.setThrowableHeading(this.motionX, this.motionY, this.motionZ,
    	        par3 * 1.5F, 1.0F);
    }
    
    @Override
    protected void entityInit()
    {
    
    	this.dataWatcher.addObject(16, Byte.valueOf((byte) 0));
    }
    
    /**
     * Similar to setArrowHeading, it's point the throwable entity to a x, y, z
     * direction.
     */
    @Override
    public void setThrowableHeading(double var1, double var3, double var5,
            float var7, float var8)
    {
    
    	float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5
    	        * var5);
    	var1 /= var9;
    	var3 /= var9;
    	var5 /= var9;
    	var1 += this.rand.nextGaussian() * 0.007499999832361937D * var8;
    	var3 += this.rand.nextGaussian() * 0.007499999832361937D * var8;
    	var5 += this.rand.nextGaussian() * 0.007499999832361937D * var8;
    	var1 *= var7;
    	var3 *= var7;
    	var5 *= var7;
    	this.motionX = var1;
    	this.motionY = var3;
    	this.motionZ = var5;
    	float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5);
    	this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(var1,
    	        var5) * 180.0D / Math.PI);
    	this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(var3,
    	        var10) * 180.0D / Math.PI);
    	this.ticksInGround = 0;
    }
    
    @Override
    @SideOnly(Side.CLIENT)
    /**
     * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX,
     * posY, posZ, yaw, pitch
     */
    public void setPositionAndRotation2(double par1, double par3, double par5,
            float par7, float par8, int par9)
    {
    
    	this.setPosition(par1, par3, par5);
    	this.setRotation(par7, par8);
    }
    
    @Override
    @SideOnly(Side.CLIENT)
    /**
     * Sets the velocity to the args. Args: x, y, z
     */
    public void setVelocity(double par1, double par3, double par5)
    {
    
    	this.motionX = par1;
    	this.motionY = par3;
    	this.motionZ = par5;
    
    	if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
    	{
    		float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5);
    		this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(par1,
    		        par5) * 180.0D / Math.PI);
    		this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(
    		        par3, var7) * 180.0D / Math.PI);
    		this.prevRotationPitch = this.rotationPitch;
    		this.prevRotationYaw = this.rotationYaw;
    		this.setLocationAndAngles(this.posX, this.posY, this.posZ,
    		        this.rotationYaw, this.rotationPitch);
    		this.ticksInGround = 0;
    	}
    }
    
    /**
     * Called to update the entity's position/logic.
     */
    @Override
    public void onUpdate()
    {
    
    	super.onUpdate();
    
    	if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F)
    	{
    		float var1 = MathHelper.sqrt_double(this.motionX * this.motionX
    		        + this.motionZ * this.motionZ);
    		this.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(
    		        this.motionX, this.motionZ) * 180.0D / Math.PI);
    		this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(
    		        this.motionY, var1) * 180.0D / Math.PI);
    	}
    
    	int var16 = this.worldObj
    	        .getBlockId(this.xTile, this.yTile, this.zTile);
    
    	if (var16 > 0)
    	{
    		Block.blocksList[var16].setBlockBoundsBasedOnState(this.worldObj,
    		        this.xTile, this.yTile, this.zTile);
    		AxisAlignedBB var2 = Block.blocksList[var16]
    		        .getCollisionBoundingBoxFromPool(this.worldObj, this.xTile,
    		                this.yTile, this.zTile);
    
    		if (var2 != null
    		        && var2.isVecInside(this.worldObj.getWorldVec3Pool()
    		                .getVecFromPool(this.posX, this.posY, this.posZ)))
    		{
    			this.inGround = true;
    		}
    	}
    
    	if (this.arrowShake > 0)
    	{
    		--this.arrowShake;
    	}
    
    	if (this.inGround)
    	{
    		int var18 = this.worldObj.getBlockId(this.xTile, this.yTile,
    		        this.zTile);
    		int var19 = this.worldObj.getBlockMetadata(this.xTile, this.yTile,
    		        this.zTile);
    
    		if (var18 == this.inTile && var19 == this.inData)
    		{
    			++this.ticksInGround;
    
    			if (this.ticksInGround == 1200)
    			{
    				this.setDead();
    			}
    		} else
    		{
    			this.inGround = false;
    			this.motionX *= this.rand.nextFloat() * 0.2F;
    			this.motionY *= this.rand.nextFloat() * 0.2F;
    			this.motionZ *= this.rand.nextFloat() * 0.2F;
    			this.ticksInGround = 0;
    			this.ticksInAir = 0;
    		}
    	} else
    	{
    		++this.ticksInAir;
    		Vec3 var17 = this.worldObj.getWorldVec3Pool().getVecFromPool(
    		        this.posX, this.posY, this.posZ);
    		Vec3 var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(
    		        this.posX + this.motionX, this.posY + this.motionY,
    		        this.posZ + this.motionZ);
    		MovingObjectPosition var4 = this.worldObj.rayTraceBlocks_do_do(
    		        var17, var3, false, true);
    		var17 = this.worldObj.getWorldVec3Pool().getVecFromPool(this.posX,
    		        this.posY, this.posZ);
    		var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(
    		        this.posX + this.motionX, this.posY + this.motionY,
    		        this.posZ + this.motionZ);
    
    		if (var4 != null)
    		{
    			var3 = this.worldObj.getWorldVec3Pool().getVecFromPool(
    			        var4.hitVec.xCoord, var4.hitVec.yCoord,
    			        var4.hitVec.zCoord);
    		}
    
    		Entity var5 = null;
    		List var6 = this.worldObj.getEntitiesWithinAABBExcludingEntity(
    		        this,
    		        this.boundingBox.addCoord(this.motionX, this.motionY,
    		                this.motionZ).expand(1.0D, 1.0D, 1.0D));
    		double var7 = 0.0D;
    		Iterator var9 = var6.iterator();
    		float var11;
    
    		while (var9.hasNext())
    		{
    			Entity var10 = (Entity) var9.next();
    
    			if (var10.canBeCollidedWith()
    			        && (var10 != this.owner || this.ticksInAir >= 5))
    			{
    				var11 = 0.3F;
    				AxisAlignedBB var12 = var10.boundingBox.expand(var11,
    				        var11, var11);
    				MovingObjectPosition var13 = var12.calculateIntercept(
    				        var17, var3);
    
    				if (var13 != null)
    				{
    					double var14 = var17.distanceTo(var13.hitVec);
    
    					if (var14 < var7 || var7 == 0.0D)
    					{
    						var5 = var10;
    						var7 = var14;
    					}
    				}
    			}
    		}
    
    		if (var5 != null)
    		{
    			var4 = new MovingObjectPosition(var5);
    		}
    
    		float var20;
    
    		if (var4 != null)
    		{
    			if (var4.entityHit != null)
    			{
    				var20 = MathHelper.sqrt_double(this.motionX * this.motionX
    				        + this.motionY * this.motionY + this.motionZ
    				        * this.motionZ);
    				int var24 = MathHelper.ceiling_double_int(var20
    				        * this.damage);
    
    				if (this.getIsCritical())
    				{
    					var24 += this.rand.nextInt(var24 / 2 + 2);
    				}
    
    				DamageSource var22 = null;
    
    				if (this.owner == null)
    				{
    					var22 = DamageSource.causeThrownDamage(this, this);
    				} else
    				{
    					var22 = DamageSource
    					        .causeThrownDamage(this, this.owner);
    				}
    
    				if (this.isBurning())
    				{
    					var4.entityHit.setFire(5);
    				}
    
    				if (var4.entityHit.attackEntityFrom(var22, var24))
    				{
    					if (var4.entityHit instanceof EntityLiving)
    					{
    
    						if (this.knockbackStrength > 0)
    						{
    							float var25 = MathHelper
    							        .sqrt_double(this.motionX
    							                * this.motionX + this.motionZ
    							                * this.motionZ);
    
    							if (var25 > 0.0F)
    							{
    								var4.entityHit.addVelocity(this.motionX
    								        * this.knockbackStrength
    								        * 0.6000000238418579D / var25,
    								        0.1D, this.motionZ
    								                * this.knockbackStrength
    								                * 0.6000000238418579D
    								                / var25);
    							}
    						}
    					}
    
    					this.worldObj.playSoundAtEntity(this, "random.bowhit",
    					        1.0F,
    					        1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
    					this.setDead();
    				} else
    				{
    					this.motionX *= -0.10000000149011612D;
    					this.motionY *= -0.10000000149011612D;
    					this.motionZ *= -0.10000000149011612D;
    					this.rotationYaw += 180.0F;
    					this.prevRotationYaw += 180.0F;
    					this.ticksInAir = 0;
    				}
    			} else
    			{
    				this.xTile = var4.blockX;
    				this.yTile = var4.blockY;
    				this.zTile = var4.blockZ;
    				this.inTile = this.worldObj.getBlockId(this.xTile,
    				        this.yTile, this.zTile);
    				this.inData = this.worldObj.getBlockMetadata(this.xTile,
    				        this.yTile, this.zTile);
    				this.motionX = (float) (var4.hitVec.xCoord - this.posX);
    				this.motionY = (float) (var4.hitVec.yCoord - this.posY);
    				this.motionZ = (float) (var4.hitVec.zCoord - this.posZ);
    				var20 = MathHelper.sqrt_double(this.motionX * this.motionX
    				        + this.motionY * this.motionY + this.motionZ
    				        * this.motionZ);
    				this.posX -= this.motionX / var20 * 0.05000000074505806D;
    				this.posY -= this.motionY / var20 * 0.05000000074505806D;
    				this.posZ -= this.motionZ / var20 * 0.05000000074505806D;
    				this.worldObj.playSoundAtEntity(this, "random.bowhit",
    				        1.0F, 1.2F / (this.rand.nextFloat() * 0.2F + 0.9F));
    				this.inGround = true;
    				this.arrowShake = 7;
    				this.setIsCritical(false);
    			}
    		}
    
    		if (this.getIsCritical())
    		{
    			for (int var21 = 0; var21 < 4; ++var21)
    			{
    				this.worldObj.spawnParticle("crit", this.posX
    				        + this.motionX * var21 / 4.0D, this.posY
    				        + this.motionY * var21 / 4.0D, this.posZ
    				        + this.motionZ * var21 / 4.0D, -this.motionX,
    				        -this.motionY + 0.2D, -this.motionZ);
    			}
    		}
    
    		this.posX += this.motionX;
    		this.posY += this.motionY;
    		this.posZ += this.motionZ;
    		var20 = MathHelper.sqrt_double(this.motionX * this.motionX
    		        + this.motionZ * this.motionZ);
    		this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
    
    		for (this.rotationPitch = (float) (Math.atan2(this.motionY, var20) * 180.0D / Math.PI); this.rotationPitch
    		        - this.prevRotationPitch < -180.0F; this.prevRotationPitch -= 360.0F)
    		{
    			;
    		}
    
    		while (this.rotationPitch - this.prevRotationPitch >= 180.0F)
    		{
    			this.prevRotationPitch += 360.0F;
    		}
    
    		while (this.rotationYaw - this.prevRotationYaw < -180.0F)
    		{
    			this.prevRotationYaw -= 360.0F;
    		}
    
    		while (this.rotationYaw - this.prevRotationYaw >= 180.0F)
    		{
    			this.prevRotationYaw += 360.0F;
    		}
    
    		this.rotationPitch = this.prevRotationPitch
    		        + (this.rotationPitch - this.prevRotationPitch) * 0.2F;
    		this.rotationYaw = this.prevRotationYaw
    		        + (this.rotationYaw - this.prevRotationYaw) * 0.2F;
    		float var23 = 0.99F;
    		var11 = 0.05F;
    
    		if (this.isInWater())
    		{
    			for (int var26 = 0; var26 < 4; ++var26)
    			{
    				float var27 = 0.25F;
    				this.worldObj.spawnParticle("bubble", this.posX
    				        - this.motionX * var27, this.posY - this.motionY
    				        * var27, this.posZ - this.motionZ * var27,
    				        this.motionX, this.motionY, this.motionZ);
    			}
    
    			var23 = 0.8F;
    		}
    
    		this.motionX *= var23;
    		this.motionY *= var23;
    		this.motionZ *= var23;
    		this.motionY -= var11;
    		this.setPosition(this.posX, this.posY, this.posZ);
    		this.doBlockCollisions();
    	}
    }
    
    /**
     * (abstract) Protected helper method to write subclass entity data to NBT.
     */
    @Override
    public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound)
    {
    
    	par1NBTTagCompound.setShort("xTile", (short) this.xTile);
    	par1NBTTagCompound.setShort("yTile", (short) this.yTile);
    	par1NBTTagCompound.setShort("zTile", (short) this.zTile);
    	par1NBTTagCompound.setByte("inTile", (byte) this.inTile);
    	par1NBTTagCompound.setByte("inData", (byte) this.inData);
    	par1NBTTagCompound.setByte("shake", (byte) this.arrowShake);
    	par1NBTTagCompound.setByte("inGround", (byte) (this.inGround ? 1 : 0));
    	par1NBTTagCompound.setByte("pickup", (byte) this.canBePickedUp);
    	par1NBTTagCompound.setDouble("damage", this.damage);
    }
    
    /**
     * (abstract) Protected helper method to read subclass entity data from NBT.
     */
    @Override
    public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound)
    {
    
    	this.xTile = par1NBTTagCompound.getShort("xTile");
    	this.yTile = par1NBTTagCompound.getShort("yTile");
    	this.zTile = par1NBTTagCompound.getShort("zTile");
    	this.inTile = par1NBTTagCompound.getByte("inTile") & 255;
    	this.inData = par1NBTTagCompound.getByte("inData") & 255;
    	this.arrowShake = par1NBTTagCompound.getByte("shake") & 255;
    	this.inGround = par1NBTTagCompound.getByte("inGround") == 1;
    
    	if (par1NBTTagCompound.hasKey("damage"))
    	{
    		this.damage = par1NBTTagCompound.getDouble("damage");
    	}
    
    	if (par1NBTTagCompound.hasKey("pickup"))
    	{
    		this.canBePickedUp = par1NBTTagCompound.getByte("pickup");
    	} else if (par1NBTTagCompound.hasKey("player"))
    	{
    		this.canBePickedUp = par1NBTTagCompound.getBoolean("player") ? 1
    		        : 0;
    	}
    }
    
    /**
     * Called by a player entity when they collide with an entity
     */
    @Override
    public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
    {
    
    	boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2
    	        && par1EntityPlayer.capabilities.isCreativeMode;
    
    	if (this.inGround && this.arrowShake <= 0)
    	{
    
    		if (!this.worldObj.isRemote)
    		{
    			if (this.canBePickedUp == 1
    			        && !par1EntityPlayer.inventory
    			                .addItemStackToInventory(stack))
    			{
    				flag = false;
    			}
    		}
    
    		if (flag)
    		{
    			this.playSound(
    			        "random.pop",
    			        0.2F,
    			        ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
    			par1EntityPlayer.onItemPickup(this, 1);
    			this.setDead();
    		}
    	}
    
    }
    
    /**
     * returns if this entity triggers Block.onEntityWalking on the blocks they
     * walk on. used for spiders and wolves to
     * prevent them from trampling crops
     */
    @Override
    protected boolean canTriggerWalking()
    {
    
    	return false;
    }
    
    @Override
    @SideOnly(Side.CLIENT)
    public float getShadowSize()
    {
    
    	return 0.0F;
    }
    
    public void setDamage(double par1)
    {
    
    	this.damage = par1;
    }
    
    public double getDamage()
    {
    
    	return this.damage;
    }
    
    /**
     * Sets the amount of knockback the arrow applies when it hits a mob.
     */
    public void setKnockbackStrength(int par1)
    {
    
    	this.knockbackStrength = par1;
    }
    
    /**
     * If returns false, the item will not inflict any damage against entities.
     */
    @Override
    public boolean canAttackWithItem()
    {
    
    	return false;
    }
    
    /**
     * Whether the arrow has a stream of critical hit particles flying behind
     * it.
     */
    public void setIsCritical(boolean par1)
    {
    
    	byte var2 = this.dataWatcher.getWatchableObjectByte(16);
    
    	if (par1)
    	{
    		this.dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 | 1)));
    	} else
    	{
    		this.dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 & -2)));
    	}
    }
    
    /**
     * Whether the arrow has a stream of critical hit particles flying behind
     * it.
     */
    public boolean getIsCritical()
    {
    
    	byte var1 = this.dataWatcher.getWatchableObjectByte(16);
    	return (var1 & 1) != 0;
    }
    }

     

  14. Would there be a way to mimic the loadTexture code from rendering, turn it into a boolean value (If no texture is available false, if there is true) and put it in my core file. I would only be able to check images but that should still be fine.

  15. for the ghost entity you should be able to get away with an if(!world.isRemote) before spawning it.

     

    as for the other bug, can we see your code rather than doing this blind?

     

    Thanks for responding but I don't think the ghost entity will be solved that way because the way I have it set up it is incased in a if(world.isRemote). Here let me show you.

     

    @Override
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
            EntityPlayer par3EntityPlayer)
    {
    
    	if (par2World.isRemote)
    	{
    		if (TuxWeaponsCore.harpoonEntity != null)
    		{
    			int i = TuxWeaponsCore.harpoonEntity.recall();
    			par1ItemStack.damageItem(i, par3EntityPlayer);
    			par3EntityPlayer.swingItem();
    		}
    
    		else
    		{
    			par2World.playSoundAtEntity(par3EntityPlayer, "random.bow",
    			        0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));
    			par2World.spawnEntityInWorld(new EntityHarpoon(par2World,
    			        par3EntityPlayer, 0.7F, 5));
    			par3EntityPlayer.swingItem();
    		}
    	}
    
    	return par1ItemStack;
    }

     

     

    I'm making a Harpoon which works similar to a fishing rod. What happens is you throw the harpoon and it will bounce off of entities it comes into contact with but it will not do any damage.

     

    As for the ghost item here's the code. It's a spear so before you through it it gets the itemstack and on the entity side it adds it to the inventory.

     

    Here's the copy code

     

    @Override
    public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World,
            EntityPlayer par3EntityPlayer)
    {
    
    	itemstack = par3EntityPlayer.inventory.getCurrentItem().copyItemStack(par1ItemStack);
    
    	if (par3EntityPlayer.capabilities.isCreativeMode
    	        || par3EntityPlayer.inventory.hasItem(this.itemID))
    	{
    		par3EntityPlayer.setItemInUse(par1ItemStack,
    		        this.getMaxItemUseDuration(par1ItemStack));
    	}
    
    	return par1ItemStack;
    }

     

     

    And the entity pickup code

     

    @Override
    public void onCollideWithPlayer(EntityPlayer par1EntityPlayer)
    {
    
    	boolean flag = this.canBePickedUp == 1 || this.canBePickedUp == 2
    	        && par1EntityPlayer.capabilities.isCreativeMode;
    
    	if (this.inGround && this.arrowShake <= 0)
    	{
    
    		if (!this.worldObj.isRemote)
    		{
    
    			if (this.canBePickedUp == 1
    			        && !par1EntityPlayer.inventory
    			                .addItemStackToInventory(stack))
    			{
    				flag = false;
    			}
    		}
    
    		if (flag)
    		{
    			this.playSound(
    			        "random.pop",
    			        0.2F,
    			        ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
    			par1EntityPlayer.onItemPickup(this, 1);
    			this.setDead();
    		}
    	}
    
    }

     

     

    Now I have partially solved the ghost item problem, by putting the if (!this.worldObj.isRemote) around the add item to inventory code and not the kill code it will put the correct itemstack in the inventory and it is not a ghost, but after it hits an entity you can not pick it up just like the arrow which I used to base this code on, so I'll look and see if there's a fix for that, I assume it has something to do with this.canBePickedUp. If I don't have the if (!this.worldObj.isRemote) it will let me pick up the item every time as a ghost and if I have it around the set dead code it will kill the entity but the client will still show it.

  16. Help, I have no idea on how to use packets. I know there's a tutorial on the forge wiki about it but it makes no sense to me. There are two glitches in my mod that I've whittled down to the client and server not matching up. One is where the client gives me a ghost item and another is an entity that only shows up client side when thrown. I've been saving the fixing of these two bugs for last because again, I have no idea how to use packets. If someone could explain to me how they work and give me the general gist of it I'm sure I can go from there.

  17. It is. I did a little trial and error so I went into one of my render files for one of my projectiles and right under the load texture I pasted the whole new file f deal and cope the file path exactly, when I ran mine craft the console told me f.exists = false. So that leads me to believe there is something in the mine craft code that adds something to the beginning of the file path, I did a little digging and couldn't find anything. I'll try looking a little harder and looking at how the Item and Block file paths work but I'm not sure if I'll find what I'm looking for there.

  18. So should that work in both the eclipse and normal environment? I tried using a .png so I didn't have to worry about the .class or .java difference and set it up pretty similar to my example but it didn't work. Another issue is that I'm using a folder instead of a .jar, would that make a difference?

  19. Try adding something like this in your write to NBT data and wherever else you try to set NBT.

    if (stack.stackTagCompound == null)
    {
    stack.setTagCompound(new NBTTagCompound());
    
    //insert NBT set thingies here
    }

     

    I know I had trouble whenever the stackTagCompound equaled null and I tried to read it the game would crash. I'm not sure if that's your problem, but it's worth a shot.

×
×
  • Create New...

Important Information

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