Jump to content

Gugu42

Members
  • Posts

    38
  • Joined

  • Last visited

Everything posted by Gugu42

  1. How damn .. It was so stupid not to see it Thanks !!
  2. Hello ! I have a little problem. I have a model that should be rendered as a 3d armor, it has around 1700 polys, but if I render it on a TileEntitySpecialRenderer, it doesn't cause any FPS drop ( or maybe 2-3FPS ) But whenever it is rendered as a 3D armor, I drop from around 100FPS to 5-10. I really don't see what could cause this. Here are the codes : The Model class : package com.gugu42.rcmod.render; import org.lwjgl.opengl.GL11; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; public class ClankBackpackRender extends ModelBiped { RcModelManager modelManager; public ClankBackpackRender() { super(); modelManager = new RcModelManager(); } public void render(Entity par1Entity, float par2, float par3, float par4, float par5, float par6, float par7) { GL11.glPushMatrix(); GL11.glTranslated(0.0d, 0.6f, 0.0f); GL11.glRotated(180, 0.0D, 0.0D, 1.0D); GL11.glScalef(0.04f, 0.04f, 0.04f); modelManager.modelClankBackpack.renderAll(); GL11.glPopMatrix(); } } The Item class : package com.gugu42.rcmod.items; import com.gugu42.rcmod.RcMod; import com.gugu42.rcmod.render.ClankBackpackRender; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.client.model.ModelBiped; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumArmorMaterial; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; public class ItemClankBackpack extends ItemArmor { public ItemClankBackpack(int par1, EnumArmorMaterial par2EnumArmorMaterial, int par3, int par4) { super(par1, par2EnumArmorMaterial, par3, par4); this.setCreativeTab(RcMod.rcTab); } @Override public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { return "rcmod:models/ClankBackpack.png"; } @Override @SideOnly(Side.CLIENT) public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) { return new ClankBackpackRender(); } } I don't think it comes from the render since it updates as often as a TileEntitySpecialRenderer
  3. I'll try to do that !
  4. Yeah, but when there are like 15 entities, 4 rockets go away, ignoring the method, and the other 5 go on only one entity, and sometimes 2
  5. And, what does your method do ? Because, I can see your code, but I don't understand what it does ( Sending a packet ?) EDIT : I have the rocket launching working, but when I fire, even if there are 9 entities, some rocket will just fly away while other might go like 3 on one entity. Here's my entity code : package com.gugu42.rcmod.entity; import java.util.List; import com.gugu42.rcmod.handler.ExtendedEntityLivingBaseTarget; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.projectile.EntityThrowable; import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumMovingObjectType; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.world.World; public class EntityRYNOAmmo extends EntityThrowable { public boolean homing = true; private int ticksAlive = 0; protected EntityLiving target; public EntityRYNOAmmo(World par1World) { super(par1World); } public EntityRYNOAmmo(World par1World, EntityPlayer par3EntityPlayer) { super(par1World, par3EntityPlayer); } protected void entityInit() { } protected float getGravityVelocity() { return 0.0F; } protected float func_70182_d() { return 1.2F; } protected float func_70183_g() { return -0.0F; } public void onUpdate() { super.onUpdate(); this.ticksAlive += 1; if (this.ticksAlive >= 300) { setDead(); this.ticksAlive = 0; } this.worldObj.spawnParticle("smoke", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); if (this.homing) { if ((this.target == null) || (this.target.velocityChanged) || (!this.target.canEntityBeSeen(this))) { this.target = getNearestEntity(); } if (this.target != null) { double d = this.target.boundingBox.minX + (this.target.boundingBox.maxX - this.target.boundingBox.minX) / 2.0D - this.posX; double d1 = this.target.boundingBox.minY + (this.target.boundingBox.maxY - this.target.boundingBox.minY) / 2.0D - this.posY; double d2 = this.target.boundingBox.minZ + (this.target.boundingBox.maxZ - this.target.boundingBox.minZ) / 2.0D - this.posZ; setThrowableHeading(d, d1, d2, 0.9F, 0.0F); } } float f4 = 0.99F; float f6 = 0.05F; if (!this.homing) { this.motionX *= f4; this.motionY *= f4; this.motionZ *= f4; this.motionY -= f6; } } private EntityLiving getTarget(double d, double d1, double d2, double d3) { double d4 = -1.0D; EntityLiving entityliving = null; List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( getThrower(), this.boundingBox.expand(16.0D, 16.0D, 16.0D)); for (int i = 0; i < list.size(); i++) { EntityLiving entityliving1 = (EntityLiving) list.get(i); if (entityliving1 != getThrower()) { double d5 = entityliving1.getDistance(d, d1, d2); if (((d3 < 0.0D) || (d5 < d3 * d3)) && ((d4 == -1.0D) || (d5 < d4)) && (entityliving1.canEntityBeSeen(this))) { d4 = d5; entityliving = entityliving1; } } } return entityliving; } public boolean validTarget(EntityLiving entityliving) { if (entityliving.equals(getThrower())) { return false; } return true; } protected void onImpact(MovingObjectPosition movingobjectposition) { if (movingobjectposition.entityHit != null) { byte b0 = 20; movingobjectposition.entityHit.attackEntityFrom( DamageSource.causeThrownDamage(this, getThrower()), b0); movingobjectposition.entityHit.getEntityData().setBoolean("isTargetedByRYNO", false); if (!this.worldObj.isRemote) { setDead(); } } for (int i = 0; i < 8; i++) { this.worldObj.spawnParticle("snowballpoof", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D); } if (!this.worldObj.isRemote) { setDead(); } if ((!this.isDead) && (movingobjectposition.typeOfHit == EnumMovingObjectType.TILE) && (!this.worldObj.isRemote)) setDead(); } private EntityLiving getNearestEntity() { EntityLiving target = null; float explosionSize = 5.0F; explosionSize *= 2.0F; int i = MathHelper.floor_double(this.posX - explosionSize - 1.0D); int j = MathHelper.floor_double(this.posX + explosionSize + 1.0D); int k = MathHelper.floor_double(this.posY - explosionSize - 1.0D); int l1 = MathHelper.floor_double(this.posY + explosionSize + 1.0D); int i2 = MathHelper.floor_double(this.posZ - explosionSize - 1.0D); int j2 = MathHelper.floor_double(this.posZ + explosionSize + 1.0D); if (!this.worldObj.isRemote) { List list = this.worldObj.getEntitiesWithinAABBExcludingEntity( getThrower(), AxisAlignedBB.getAABBPool().getAABB(i, k, i2, j, l1, j2)); for (int k2 = 0; k2 < list.size(); k2++) { Entity entity = (Entity) list.get(k2); if (((entity instanceof EntityLiving)) && (((EntityLiving) entity).canEntityBeSeen(this))) { target = (EntityLiving) entity; if(!target.getEntityData().getBoolean("isTargetedByRYNO")){ target.getEntityData().setBoolean("isTargetedByRYNO", true); return target; } } } } return target; } }
  6. GameRegistry.registerBlock(block, "block") the "block" is the name I think.
  7. To other rockets would have some random flying. The weapon I'm trying to recreate is the RYNO from Ratchet & Clank. Here's a video showing the weapon in the original game : ( It's only for the first minute, after that, it's the other versions of the weapon etc.. ) I'll try what you said EDIT : I tried, but since the entity all spawns at the same time, it looks bad, is there anyway to make the method wait for 1 tick between each entitySpawn ? ( Here's my right click method : public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if (!par2World.isRemote) { EntityRYNOAmmo ent1 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent2 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent3 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent4 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent5 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent6 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent7 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent8 = new EntityRYNOAmmo(par2World, par3EntityPlayer); EntityRYNOAmmo ent9 = new EntityRYNOAmmo(par2World, par3EntityPlayer); par2World.spawnEntityInWorld(ent1); par2World.spawnEntityInWorld(ent2); par2World.spawnEntityInWorld(ent3); par2World.spawnEntityInWorld(ent4); par2World.spawnEntityInWorld(ent5); par2World.spawnEntityInWorld(ent6); par2World.spawnEntityInWorld(ent7); par2World.spawnEntityInWorld(ent8); par2World.spawnEntityInWorld(ent9); } if (!par3EntityPlayer.capabilities.isCreativeMode) { if (maxAmmo - par1ItemStack.getItemDamage() > 0) { par1ItemStack.damageItem(1, par3EntityPlayer); } } return par1ItemStack; }
  8. Hello ! I have a little problem. I don't have any special code that makes me crash etc... So, I want to make a rocket launcher that fire 9 rockets ( I have this already done ) The rockets are homing rockets, but since it fires 9 rockets, I don't want an entity to be targeted by more than 1 rocket, how could I do that ? I tought about applying a boolean to the targeted entity, and in the rocket code, something that verify if the boolean is true before making the rocket targeting the entity. How could I do ?
  9. I solved it by putting the condition in updateScreen() Thanks
  10. Hello ! I have a problem with a GUI Button I want it to change state ( enabled / disabled ) wether or not I put a certain item in a slot. It works, but only if I put the item, close the GUI and reopen it. The button doesn't update when the correct item is put in the slot, and I must close/reopen the GUI for it to update. http://pastebin.com/pVnsNtTN PS : I guess it's because it's in a method that doesn't get updated every tick, but then, I don't know where to put the condition
  11. Hello everyone. I have a problem with my Gui. Everytime I add the method initGui(), the Slots gets misplaced and all buggy My Gui class : http://pastebin.com/TsFrhmFZ Screenshots : Without the method : http://puu.sh/69L64.jpg With the method : http://puu.sh/69L0j.jpg ( I want buttons, that's why there is a button )
  12. Like an int currentAmmo, and another int maxAmmo ? If yes, I tried that, but it causes a strange bug : When one item has 0 ammo, all others instances of this item have 0 too
  13. Hello ! I'm trying to make an Item ( a "gun" wich uses it's own durability to contain the ammo). The problem is that I don't want it to be destroyed once it's empty ( Durability 0 ) How can I stop it from breaking ? I tried this in my item : public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) { if(par1ItemStack.getItemDamage() > 0){ if(!par2World.isRemote){ //random code } } return par1ItemStack; } But it just don't do the code specified
×
×
  • Create New...

Important Information

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