Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8] Primed TNT incorrect position
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 0
JimiIT92

[1.8] Primed TNT incorrect position

By JimiIT92, September 7, 2015 in Modder Support

  • Start new topic

Recommended Posts

JimiIT92    19

JimiIT92

JimiIT92    19

  • Dragon Slayer
  • JimiIT92
  • Members
  • 19
  • 723 posts
Posted September 7, 2015

I'm making a custom tnt but if i set it on fire when there is a block above it it has a strange animation. Here is a video to show you what i mean

https://www.youtube.com/watch?v=8fNatm6ebPg

And here is my entity class

package blaze.entities;

import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityTNTPrimed;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.world.World;

public class EntityAtomicTNTPrimed extends EntityTNTPrimed
{
/** How long the fuse is */
public int fuse;
private EntityLivingBase tntPlacedBy;

public EntityAtomicTNTPrimed(World par1World)
{
	super(par1World);
	this.fuse = 80;
}

public EntityAtomicTNTPrimed(World par1World, double par2, double par4, double par6, EntityLivingBase par8EntityLivingBase)
{
	this(par1World);
	this.setPosition(par2, par4, par6);
	float f = (float)(Math.random() * Math.PI * 2.0D);
	this.motionX = (double)(-((float)Math.sin((double)f)) * 0.02F);
	this.motionY = 0.20000000298023224D;
	this.motionZ = (double)(-((float)Math.cos((double)f)) * 0.02F);
	this.fuse = 80;
	this.prevPosX = par2;
	this.prevPosY = par4;
	this.prevPosZ = par6;
	this.tntPlacedBy = par8EntityLivingBase;
}

/**
 * Called to update the entity's position/logic.
 */
public void onUpdate()
{
	this.prevPosX = this.posX;
	this.prevPosY = this.posY;
	this.prevPosZ = this.posZ;
	this.motionY -= 0.03999999910593033D;
	this.moveEntity(this.motionX, this.motionY, this.motionZ);
	this.motionX *= 0.9800000190734863D;
	this.motionY *= 0.9800000190734863D;
	this.motionZ *= 0.9800000190734863D;

	if (this.onGround)
	{
		this.motionX *= 0.699999988079071D;
		this.motionZ *= 0.699999988079071D;
		this.motionY *= -0.5D;
	}

	if (this.fuse-- <= 0)
	{
		this.setDead();

		if (!this.worldObj.isRemote)
		{
			this.explode();
		}
	}
	else
	{
		this.worldObj.spawnParticle(EnumParticleTypes.SMOKE_NORMAL, this.posX, this.posY + 0.5D, this.posZ, 0.0D, 0.0D, 0.0D);
	}
}

private void explode()
{
	float f = 36.0F;
	this.worldObj.createExplosion(this, this.posX, this.posY, this.posZ, f, true);
}
}

 

Any idea about why this happens? :/

Share this post


Link to post
Share on other sites

JimiIT92    19

JimiIT92

JimiIT92    19

  • Dragon Slayer
  • JimiIT92
  • Members
  • 19
  • 723 posts
Posted September 7, 2015

Alright, it turns out that it was a registration error. I've now registered my entity with this values

EntityRegistry.registerModEntity(EntityAtomicTNTPrimed.class, "atomicTNT", starting_id+3, BL.instance, 160, 10, true);

and it worked :)

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • yegor
      [1.12.2] Transparent armor not rendering properly.

      By yegor · Posted 1 hour ago

      In my mod I have transparent armor which I created with an "ArmorSlime" class, which extends ItemArmor. The item texture for my armor is slightly transparent and it renders correctly, even in item frames.   The armor model uses a slightly transparent texture, which works on the player model, but when I place the armor on an armor stand, it is rendered fully opaque.   Is this a mod issue, or an issue with minecraft itself? Is there a solution?  
    • yegor
      moving topic to just modding support

      By yegor · Posted 1 hour ago

      Moved
    • J0WAY
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY · Posted 1 hour ago

      Okay, But my main problem is why won't my sword spawn on my mob because i did just change it to the vanilla code and it still doesn't work.  
    • thedarkcolour
      [1.14] Patching method with coremod in TreeFeature causes IncompatibleClassChangeError

      By thedarkcolour · Posted 4 hours ago

      https://github.com/thedarkcolour/Future-MC/tree/1.14
    • Draco18s
      [1.14] layout of a modpack

      By Draco18s · Posted 4 hours ago

      I'm pretty sure I've left some comments on his videos about the mistakes he's perpetuating, but its not like anyone reads those.
  • Topics

    • yegor
      0
      [1.12.2] Transparent armor not rendering properly.

      By yegor
      Started 1 hour ago

    • yegor
      0
      moving topic to just modding support

      By yegor
      Started 1 hour ago

    • J0WAY
      2
      [1.12.2] How do i make it so my sword renders in my mobs hand?.

      By J0WAY
      Started 6 hours ago

    • thedarkcolour
      15
      [1.14] Patching method with coremod in TreeFeature causes IncompatibleClassChangeError

      By thedarkcolour
      Started 22 hours ago

    • JetCobblestone
      4
      [1.14] layout of a modpack

      By JetCobblestone
      Started 10 hours ago

  • Who's Online (See full list)

    • ericgolde555
    • DaemonUmbra
    • thedarkcolour
    • AtlasTheFirst
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [1.8] Primed TNT incorrect position
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community