Open Iron door/blockstate

Started by KBEHAN on Sun, 03/12/2017 - 13:56

Topic category: Help with modding (Java Edition)

Last seen on 23:21, 14. Apr 2019
Joined Jul 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Open Iron door/blockstate
Sun, 03/12/2017 - 16:39 (edited)

I want my projectile to open door, I havn't had much experience with blockstate.  I am in 1.7.10.  Here is my current code:

Edited by Klemen on Sun, 03/12/2017 - 16:39
Last seen on 23:21, 14. Apr 2019
Joined Jul 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I am very stumped on this.  I
Tue, 03/14/2017 - 18:29

I am very stumped on this.  I do not know what propper code would be for projectile.  Most of Forums topis is for items.  I am very new to metadata and blockstate.

Last seen on 23:21, 14. Apr 2019
Joined Jul 2015
User points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Ok, So I have changed my code
Wed, 03/15/2017 - 01:02

Ok, So I have changed my code and noe I am only getting 3 errors instead of 50!

they are not complicated errors but much confuse me.  I am not sure why I am getting this errors.  IF anyone can tell me what I did wrong please tell me.

/Users/Maurice/Desktop/HarryPotterCraft/MCreator 1.7.2 [1.7.10] Mac-Linux 32-64bit/forge/build/sources/java/mod/mcreator/mcreator_alohomora.java:137: error: Entityalohomora is not abstract and does not override abstract method onImpact(MovingObjectPosition) in EntityThrowable  public static class Entityalohomora extends EntityThrowable{                ^ :compileJava FAILED /Users/Maurice/Desktop/HarryPotterCraft/MCreator 1.7.2 [1.7.10] Mac-Linux 32-64bit/forge/build/sources/java/mod/mcreator/mcreato: error: method doesBUILD FAILED  not override or implement a method from a supertype r_alohomora.java:154Total time: ^ 7.631 secs @Override   Task completed with return code 1 in 8220 milliseconds /Users/Maurice/Desktop/HarryPotterCraft/MCreator 1.7.2 [1.7.10] Mac-Linux 32-64bit/forge/buil: error: method does not override or implement a method from a supertype d/sources/java/mod/mcreator/mcreator_alohomora.java:176@Override ^ 3 errors

 these are my errors.

 

this is code:

 

@SuppressWarnings("unchecked")
public class mcreator_alohomora {

    public static int mobid = 0;
    public Object instance;
 
    public void load(){}
 
    public void generateNether(World world, Random random, int chunkX, int chunkZ){}
    public void generateSurface(World world, Random random, int chunkX, int chunkZ){}
    public int addFuel(ItemStack fuel){
        return 0;
    }
    @SideOnly(Side.CLIENT)
    public void registerRenderers(){
        RenderingRegistry.registerEntityRenderingHandler(mcreator_alohomora.Entityalohomora.class, new RenderSnowball(mcreator_crucioCurse.block));
    }
 
 
    public void serverLoad(FMLServerStartingEvent event){}
    public void preInit(FMLPreInitializationEvent event){
        int entityID = EntityRegistry.findGlobalUniqueEntityId();
        mobid = entityID;
        EntityRegistry.registerGlobalEntityID(mcreator_alohomora.Entityalohomora.class, "alohomora", entityID);
        EntityRegistry.registerModEntity(mcreator_alohomora.Entityalohomora.class, "alohomora", entityID, instance, 64, 1, true);
       
 
       
    }
 
 
 public static class Entityalohomora extends EntityThrowable{

int timer = 0;
 
public Entityalohomora(World par1World, double par2, double par4, double par6)
{
super(par1World, par2, par4, par6);
}
public Entityalohomora(World par1World, EntityLivingBase par2EntityLivingBase)
{
super(par1World, par2EntityLivingBase);
}
public Entityalohomora(World par1World)
{
super(par1World);
}

@Override  
     public void onUpdate(EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
     {
          ++timer;
          super.onUpdate();
          if (timer % 2 == 0) {
               this.worldObj.spawnParticle("enchantmenttable", this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D);
          }
          
          if (this.timer == 600) {
          this.setDead();
        }
     }
     
     protected float getGravityVelocity()
    {
        return 0.00F;
    }

/**
 * Called when this EntityThrowable hits a block or entity.
 */
@Override
public void onImpact(MovingObjectPosition mop, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ) {
     if(mop.entityHit != null) {

          float throwDamage = 5;
          mop.entityHit.attackEntityFrom(DamageSource.causeThrownDamage(this, getThrower()), throwDamage);

          if(mop.entityHit instanceof EntityLivingBase) {
               byte b0 = 18;

               switch(worldObj.difficultySetting) {
                    case NORMAL:
                         b0 = 10;
                         break;
                    case HARD:
                         b0 = 40;
                         break;
                    default:
                         break;
               }
               Block block = world.getBlock(x, y, z);
               if(block instanceof BlockDoor){
               int i1 = ((BlockDoor) block).func_150012_g(world, x, y, z);
            int j1 = i1 & 7;
            j1 ^= 4;
            
               if ((i1 & 8) == 0){
                    world.setBlockMetadataWithNotify(x, y, z, j1, 2);
                    world.markBlockRangeForRenderUpdate(x, y, z, x, y, z);
            }else
            {
                world.setBlockMetadataWithNotify(x, y - 1, z, j1, 2);
                world.markBlockRangeForRenderUpdate(x, y - 1, z, x, y, z);
            }
               world.playAuxSFXAtEntity(player, 1003, x, y, z, 0);   

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