<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Faire un double extends]]></title><description><![CDATA[<p dir="auto">Bonjour, pour faire ma “Dynamite”, j’ai besoin d’extends la classe EntityThrowable pour la lancer mais aussi la classe Entity pour la faire exploser. comment faire ?</p>
]]></description><link>https://www.minecraftforgefrance.fr/topic/5754/faire-un-double-extends</link><generator>RSS for Node</generator><lastBuildDate>Wed, 16 Sep 2026 09:05:11 GMT</lastBuildDate><atom:link href="https://www.minecraftforgefrance.fr/topic/5754.rss" rel="self" type="application/rss+xml"/><pubDate>Sun, 01 Sep 2019 15:12:53 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:53:55 GMT]]></title><description><![CDATA[<p dir="auto">ok j ai trouver un bout de code qui devrais te servir</p>
<pre><code>package flaxbeard.dynamite.entity;

import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.List;

import flaxbeard.dynamite.DynamiteMod;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
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.util.Vec3;
import net.minecraft.world.World;

public class EntityDynamite extends EntityThrowable
{
	boolean stopped = false;
	boolean bounce = false;
	public int type = 0;
	int fuse;
	
	public EntityDynamite(World par1World) {
		super(par1World);
		
	}
	public EntityDynamite(World par1World, double x, double y, double z, float yaw, float pitch, double force, int fuseLength, int ty) {
		super(par1World);
		this.setRotation(yaw, 0);
		System.out.println(yaw);
		System.out.println(pitch);
        double xHeading = -MathHelper.sin((yaw * 3.141593F) / 180F);
        double zHeading = MathHelper.cos((yaw * 3.141593F) / 180F);
        motionX = force*xHeading*MathHelper.cos((pitch / 180F) * 3.141593F);
        motionY = -force*MathHelper.sin((pitch / 180F) * 3.141593F);
        motionZ = force*zHeading*MathHelper.cos((pitch / 180F) * 3.141593F);

        setPosition(x+xHeading*0.8, y+1.5, z+zHeading*0.8);
        prevPosX = posX;
        prevPosY = posY;
        prevPosZ = posZ;
 
        fuse = fuseLength;
        type = ty;
        System.out.println(type);
	}
	
	public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
	{
		return false;
	}
	
    public EntityDynamite(World world, Entity entity, double force, int ty)
    {
        this(world, entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch, force, 50, ty);
    }
    
    public void onUpdate()
    {
        if(fuse-- &lt;= 0)
        {
        	if (!worldObj.isRemote) {
        	
        	worldObj.createExplosion(null, posX, posY, posZ, 2.0F, true);
            this.setDead();
        	}
            
        }
        if(stopped &amp;&amp; !worldObj.isRemote) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream(7);
            DataOutputStream outputStream = new DataOutputStream(bos);
            try
            {
                outputStream.writeByte(1);
                outputStream.writeInt(this.entityId);
                outputStream.writeInt((int) posX);
                outputStream.writeInt((int) posY);
                outputStream.writeInt((int) posZ);
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
            Packet250CustomPayload packet = new Packet250CustomPayload();
            packet.channel = "DynamiteMod";
            packet.data = bos.toByteArray();
            packet.length = bos.size();
            PacketDispatcher.sendPacketToAllAround(posX, posY, posZ, 50, worldObj.provider.dimensionId, packet);
        }
        if(!(stopped))
        {
                double prevVelX = motionX;
                double prevVelY = motionY;
                double prevVelZ = motionZ;
                prevPosX = posX;
                prevPosY = posY;
                prevPosZ = posZ;
                moveEntity(motionX, motionY, motionZ);
         
                boolean collided = false;
                        
                if(motionX!=prevVelX)
                {
                		if (type == 1) {
                			stopped = true;
                            motionX = 0;
                            motionY = 0;
                            motionZ = 0;
                		}
                		else
                		{
                        motionX = -0.5*prevVelX;
                        collided = true;
                		}
                }
                if(motionZ!=prevVelZ)
                {
	            		if (type == 1) {
	            			stopped = true;
	                        motionX = 0;
	                        motionY = 0;
	                        motionZ = 0;
	            		}
	            		else
	            		{
                        motionZ = -0.5*prevVelZ;
	            		}
                }
         
                if(motionY!=prevVelY)
                {
	            		if (type == 1) {
	            			stopped = true;
	                        motionX = 0;
	                        motionY = 0;
	                        motionZ = 0;
	            		}
	            		else
	            		{
                        motionY = -prevVelY;
                        collided = true;   
	            		}
                }
                else
                {
                        motionY -= 0.04;
                }
         
                if(collided)
                {
						motionX *= 0.5;
                        motionY *= 0.1;
                        motionZ *= 0.5;
                }
         
                motionX *= 0.99;
                motionY *= 0.99;
                motionZ *= 0.99;
                System.out.println(Boolean.toString(worldObj.isRemote) + Integer.toString(entityId));
                if(onGround &amp;&amp; (motionX*motionX+motionY*motionY+motionZ*motionZ)&lt;0.02)
                {
                        stopped = true;
                        motionX = 0;
                        motionY = 0;
                        motionZ = 0;
                }
        }
    }

	@Override
	protected void onImpact(MovingObjectPosition movingobjectposition) {
		// TODO Auto-generated method stub
		
	}
	public void stop(int x, int y, int z) {
		stopped = true;
		this.posX = x;
		this.posY = y;
		this.posZ = z;
		System.out.println("i trai to stop but i fal.");
	}

	
  
}
</code></pre>
]]></description><link>https://www.minecraftforgefrance.fr/post/67077</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67077</guid><dc:creator><![CDATA[Heaven]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:53:55 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 17:01:35 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/heaven" aria-label="Profile: Heaven">@<bdi>Heaven</bdi></a> merci</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67081</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67081</guid><dc:creator><![CDATA[Drastic]]></dc:creator><pubDate>Sun, 01 Sep 2019 17:01:35 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 16:58:11 GMT]]></title><description><![CDATA[<p dir="auto">la je ne pourrais pas t aider demande sur le discorde ou regarde dans la classe de le boule de neige jsp</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67080</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67080</guid><dc:creator><![CDATA[Heaven]]></dc:creator><pubDate>Sun, 01 Sep 2019 16:58:11 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 16:57:05 GMT]]></title><description><![CDATA[<p dir="auto">merci, mais je ne sais toujours pas comment faire pour mettre un model + texture</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67079</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67079</guid><dc:creator><![CDATA[Drastic]]></dc:creator><pubDate>Sun, 01 Sep 2019 16:57:05 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:53:55 GMT]]></title><description><![CDATA[<p dir="auto">ok j ai trouver un bout de code qui devrais te servir</p>
<pre><code>package flaxbeard.dynamite.entity;

import cpw.mods.fml.common.network.PacketDispatcher;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

import java.io.ByteArrayOutputStream;
import java.io.DataOutputStream;
import java.util.List;

import flaxbeard.dynamite.DynamiteMod;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.packet.Packet250CustomPayload;
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.util.Vec3;
import net.minecraft.world.World;

public class EntityDynamite extends EntityThrowable
{
	boolean stopped = false;
	boolean bounce = false;
	public int type = 0;
	int fuse;
	
	public EntityDynamite(World par1World) {
		super(par1World);
		
	}
	public EntityDynamite(World par1World, double x, double y, double z, float yaw, float pitch, double force, int fuseLength, int ty) {
		super(par1World);
		this.setRotation(yaw, 0);
		System.out.println(yaw);
		System.out.println(pitch);
        double xHeading = -MathHelper.sin((yaw * 3.141593F) / 180F);
        double zHeading = MathHelper.cos((yaw * 3.141593F) / 180F);
        motionX = force*xHeading*MathHelper.cos((pitch / 180F) * 3.141593F);
        motionY = -force*MathHelper.sin((pitch / 180F) * 3.141593F);
        motionZ = force*zHeading*MathHelper.cos((pitch / 180F) * 3.141593F);

        setPosition(x+xHeading*0.8, y+1.5, z+zHeading*0.8);
        prevPosX = posX;
        prevPosY = posY;
        prevPosZ = posZ;
 
        fuse = fuseLength;
        type = ty;
        System.out.println(type);
	}
	
	public boolean attackEntityFrom(DamageSource par1DamageSource, int par2)
	{
		return false;
	}
	
    public EntityDynamite(World world, Entity entity, double force, int ty)
    {
        this(world, entity.posX, entity.posY, entity.posZ, entity.rotationYaw, entity.rotationPitch, force, 50, ty);
    }
    
    public void onUpdate()
    {
        if(fuse-- &lt;= 0)
        {
        	if (!worldObj.isRemote) {
        	
        	worldObj.createExplosion(null, posX, posY, posZ, 2.0F, true);
            this.setDead();
        	}
            
        }
        if(stopped &amp;&amp; !worldObj.isRemote) {
            ByteArrayOutputStream bos = new ByteArrayOutputStream(7);
            DataOutputStream outputStream = new DataOutputStream(bos);
            try
            {
                outputStream.writeByte(1);
                outputStream.writeInt(this.entityId);
                outputStream.writeInt((int) posX);
                outputStream.writeInt((int) posY);
                outputStream.writeInt((int) posZ);
            }
            catch (Exception ex)
            {
                ex.printStackTrace();
            }
            Packet250CustomPayload packet = new Packet250CustomPayload();
            packet.channel = "DynamiteMod";
            packet.data = bos.toByteArray();
            packet.length = bos.size();
            PacketDispatcher.sendPacketToAllAround(posX, posY, posZ, 50, worldObj.provider.dimensionId, packet);
        }
        if(!(stopped))
        {
                double prevVelX = motionX;
                double prevVelY = motionY;
                double prevVelZ = motionZ;
                prevPosX = posX;
                prevPosY = posY;
                prevPosZ = posZ;
                moveEntity(motionX, motionY, motionZ);
         
                boolean collided = false;
                        
                if(motionX!=prevVelX)
                {
                		if (type == 1) {
                			stopped = true;
                            motionX = 0;
                            motionY = 0;
                            motionZ = 0;
                		}
                		else
                		{
                        motionX = -0.5*prevVelX;
                        collided = true;
                		}
                }
                if(motionZ!=prevVelZ)
                {
	            		if (type == 1) {
	            			stopped = true;
	                        motionX = 0;
	                        motionY = 0;
	                        motionZ = 0;
	            		}
	            		else
	            		{
                        motionZ = -0.5*prevVelZ;
	            		}
                }
         
                if(motionY!=prevVelY)
                {
	            		if (type == 1) {
	            			stopped = true;
	                        motionX = 0;
	                        motionY = 0;
	                        motionZ = 0;
	            		}
	            		else
	            		{
                        motionY = -prevVelY;
                        collided = true;   
	            		}
                }
                else
                {
                        motionY -= 0.04;
                }
         
                if(collided)
                {
						motionX *= 0.5;
                        motionY *= 0.1;
                        motionZ *= 0.5;
                }
         
                motionX *= 0.99;
                motionY *= 0.99;
                motionZ *= 0.99;
                System.out.println(Boolean.toString(worldObj.isRemote) + Integer.toString(entityId));
                if(onGround &amp;&amp; (motionX*motionX+motionY*motionY+motionZ*motionZ)&lt;0.02)
                {
                        stopped = true;
                        motionX = 0;
                        motionY = 0;
                        motionZ = 0;
                }
        }
    }

	@Override
	protected void onImpact(MovingObjectPosition movingobjectposition) {
		// TODO Auto-generated method stub
		
	}
	public void stop(int x, int y, int z) {
		stopped = true;
		this.posX = x;
		this.posY = y;
		this.posZ = z;
		System.out.println("i trai to stop but i fal.");
	}

	
  
}
</code></pre>
]]></description><link>https://www.minecraftforgefrance.fr/post/67077</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67077</guid><dc:creator><![CDATA[Heaven]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:53:55 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:46:27 GMT]]></title><description><![CDATA[<p dir="auto"><a class="plugin-mentions-user plugin-mentions-a" href="/user/heaven" aria-label="Profile: Heaven">@<bdi>Heaven</bdi></a> malheureusement la soluce n’y est pas</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67076</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67076</guid><dc:creator><![CDATA[Drastic]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:46:27 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:44:15 GMT]]></title><description><![CDATA[<p dir="auto">je viens de te donner la soluce (peut etre)</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67075</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67075</guid><dc:creator><![CDATA[Heaven]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:44:15 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:43:46 GMT]]></title><description><![CDATA[<p dir="auto">oui mais je netrouve pas <img src="https://www.minecraftforgefrance.fr/assets/plugins/nodebb-plugin-emoji/emoji/android/1f61e.png?v=191f1bb5acb" class="not-responsive emoji emoji-android emoji--disappointed" style="height:23px;width:auto;vertical-align:middle" title=":(" alt="😞" /></p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67074</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67074</guid><dc:creator><![CDATA[Drastic]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:43:46 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:43:26 GMT]]></title><description><![CDATA[<p dir="auto">et bien il faut voir dans la classe de la Tnt<br />
je ne suis pas sur mais cette méthode peut etre utile</p>
<pre><code> public void onBlockDestroyedByExplosion(World p_149723_1_, int p_149723_2_, int p_149723_3_, int p_149723_4_, Explosion p_149723_5_)
    {
        if (!p_149723_1_.isRemote)
        {
            EntityTNTPrimed entitytntprimed = new EntityTNTPrimed(p_149723_1_, (double)((float)p_149723_2_ + 0.5F), (double)((float)p_149723_3_ + 0.5F), (double)((float)p_149723_4_ + 0.5F), p_149723_5_.getExplosivePlacedBy());
            entitytntprimed.fuse = p_149723_1_.rand.nextInt(entitytntprimed.fuse / 4) + entitytntprimed.fuse / 8;
            p_149723_1_.spawnEntityInWorld(entitytntprimed);
        }
    }
</code></pre>
]]></description><link>https://www.minecraftforgefrance.fr/post/67073</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67073</guid><dc:creator><![CDATA[Heaven]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:43:26 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:39:56 GMT]]></title><description><![CDATA[<p dir="auto">alors en fait g mis le explode alors que pas besoin. par contre, comment régler la taille de l’explosion ?</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67072</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67072</guid><dc:creator><![CDATA[Drastic]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:39:56 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:28:52 GMT]]></title><description><![CDATA[<p dir="auto">tu pourrais peut être regarder dans la classe de la Tnt ?</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67071</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67071</guid><dc:creator><![CDATA[Heaven]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:28:52 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:25:32 GMT]]></title><description><![CDATA[<p dir="auto">Ton</p>
<pre><code>private void explode()
{
    float f = 4.0F;
    this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
}
</code></pre>
<p dir="auto">est mal placé (déjà dans une méthode de ta classe).<br />
Il n’y a pas une méthode qui fait la même chose et que tu pourrais appeler à la place ?</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67070</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67070</guid><dc:creator><![CDATA[John_71]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:25:32 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:21:46 GMT]]></title><description><![CDATA[<p dir="auto">oui mais si je met</p>
<pre><code>private void explode()
            {
                float f = 4.0F;
                this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
            }
</code></pre>
<p dir="auto">ca me met une erreur : the method explode is undefined for  the type “maclasse”</p>
<pre><code>package com.extremium.mod.entity;

import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.monster.EntityBlaze;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.util.DamageSource;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.world.World;

public class DynamiteEntity extends EntityThrowable
{
    private static final String __OBFID = "CL_00001722";

    public DynamiteEntity(World p_i1773_1_)
    {
        super(p_i1773_1_);
    }

    public DynamiteEntity(World p_i1774_1_, EntityLivingBase p_i1774_2_)
    {
        super(p_i1774_1_, p_i1774_2_);
    }

    public DynamiteEntity(World p_i1775_1_, double p_i1775_2_, double p_i1775_4_, double p_i1775_6_)
    {
        super(p_i1775_1_, p_i1775_2_, p_i1775_4_, p_i1775_6_);
    }

    /**
     * Called when this EntityThrowable hits a block or entity.
     */
    protected void onImpact(MovingObjectPosition p_70184_1_)
    {
        if (p_70184_1_.entityHit != null)
        {
            byte b0 = 0;
            

            if (p_70184_1_.entityHit instanceof EntityBlaze)
            {
                b0 = 3;
            }

            p_70184_1_.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, this.getThrower()), (float)b0);
            
            private void explode()
            {
                float f = 4.0F;
                this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
            }
        }

        for (int i = 0; i &lt; 8; ++i)
        {
           
        }

        if (!this.worldObj.isRemote)
        {
            this.setDead();
        }
        
        
    }
}


</code></pre>
]]></description><link>https://www.minecraftforgefrance.fr/post/67069</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67069</guid><dc:creator><![CDATA[Drastic]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:21:46 GMT</pubDate></item><item><title><![CDATA[Reply to Faire un double extends on Sun, 01 Sep 2019 15:16:14 GMT]]></title><description><![CDATA[<p dir="auto">Par hasard, est-ce-que <code>EntityThrowable extends Entity</code> ?<br />
Si c’est le cas, tu as juste à faire un <code>extends EntityThrowable</code> !</p>
]]></description><link>https://www.minecraftforgefrance.fr/post/67068</link><guid isPermaLink="true">https://www.minecraftforgefrance.fr/post/67068</guid><dc:creator><![CDATA[John_71]]></dc:creator><pubDate>Sun, 01 Sep 2019 15:16:14 GMT</pubDate></item></channel></rss>