Boomerang type projectile

Started by KBEHAN on

Topic category: Help with modding (Java Edition)

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Boomerang type projectile
Sat, 12/31/2016 - 01:09 (edited)

Hey, it's me again here with another complex idea I need help with.

 

I want my entity throwable to have a boomerang type function.  So I kind of know the function of this.  I have code for damaging the entity.  But I need help with actual code for the rest of it.  here is my idea for the mechanic:

so,  entity throwable dissapears when it hits a block or entity is because of set dead.  what I need is to delete that part (I need it later though) and add in a motion, so in place of set dead when it hits a block or entity it has a motion. When it hits an entity or a block the motion will return/be backwards.  Then I need CollideWithPlayer that will 1. Set dead the entity and 2. give the player the item back. 

If anyone wants to help or has code or something please reply.  I am working in 1.7.10  version.

Edited by KBEHAN on Sat, 12/31/2016 - 01:09
Last seen on 23:21, 14. Apr 2019
Joined Jul 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Why are you negaing the
Sun, 01/15/2017 - 19:17

@#7

@Override
    public void onUpdate() {
        if (--distance < -LIFESPAN && !worldObj.isRemote) {
            worldObj.spawnEntityInWorld(new EntityItem(worldObj, posX, posY, posZ,
            setDead();
        }
    }

hmm, getshield())); is wrong.  Isn't for item it must be

mcreator_stevensShield.block?

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:It whole does not do almost
Sun, 01/15/2017 - 19:24

@#8

@Override
    public void onUpdate() {
         if(hasCollided){
inAirTicks++;
if(inAirTicks > 60){
//DO SOME STUFF
}
}

inAirTicks must have int?

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:Why are you negaing the
Sun, 01/15/2017 - 19:24

@#7.3 I do not know names of all items in your mod. Also I stated GitHub is not key to all answers.

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
No, it is going to be a
Sun, 01/15/2017 - 19:26

No, it is going to be a String......... :D
Of course that if you are doing timer, you will use Integer,Float,Double or Long.

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:No, it is going to be a
Sun, 01/15/2017 - 19:40

@#9

won't this setDead even when I'm throwing it at the entity?

 

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:No, it is going to be a
Sun, 01/15/2017 - 19:43

@#9.1 Why it should?

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:RE:RE:No, it is going to be a
Sun, 01/15/2017 - 19:50

@#9.1.1

unless it is looking for the entity stopped in one place in air then setDead.

 

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ehmmm? What the code that I
Sun, 01/15/2017 - 19:57

Ehmmm? What the code that I wrote does is:
If boolean hasCollided (that you will set to true in onImpact() ) is true , increase inAirTicks by 1. If inAirTicks is bigger than 60 (60 is just random value by me , you can use what you want) , then do the stuff that you want , like killing the entity and spawning the item.
 

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Ehmmm? What the code that I
Sun, 01/15/2017 - 20:00

@#10

like this?

@Override
    public void onUpdate() {
         if(hasCollided){
inAirTicks++;
if(inAirTicks > 60){
setDead();
    }
}

edit:I recompiled it and I got a bunhc of errors

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is the void closed?
Sun, 01/15/2017 - 20:05

Is the void closed?

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:Is the void closed?
Sun, 01/15/2017 - 20:10

@#11

/Applications/MCreator 1.5.9 [1.7.10] Mac-Linux/forge/build/sources/java/mod/mcreator/mcreator_shield.java:152: error: cannot find symbol
>:compileJava FAILED
>         if(hasCollided){
>            ^
>  symbol:   variable hasCollided
>  location: class Entityshield
>/Applications/MCreator 1.5.9 [1.7.10] Mac-Linux/forge/build/sources/java/mod/mcreator/mcreator_shield.java:152: error: illegal start of type
>         if(hasCollided){
>           ^
>/Applications/MCreator 1.5.9 [1.7.10] Mac-Linux/forge/build/sources/java/mod/mcreator/mcreator_shield.java:153: error: cannot find symbol
>inAirTicks++;
>BU>  symbol:   variable inAirTicks
ILD FAILED
>^
>Total time: 13.825 secs
>  location: class Entityshield
>/Applications/MCreator 1.5.9 [1.7.10] Mac-Linux/forge/build/sources/java/mod/mcreator/mcreator_shield.java:154: error: cannot find symbol
>if(inAirTicks > 60){
>   ^
>  symbol:   variable inAirTicks
>  location: class Entityshield
>Note: /Applications/MCreator 1.5.9 [1.7.10] Mac-Linux/forge/build/sources/java/mod/mcreator/mcreator_sugilitesFlail.java uses unchecked or unsafe operations.
>4 errors

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I thought that it is pretty
Sun, 01/15/2017 - 20:18

I thought that it is pretty obvious that you need first declare the variables

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

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
RE:I thought that it is pretty
Sun, 01/15/2017 - 20:30

@#12

I have declared inAirTicks but am having trouble with hasCollided

Last seen on 22:13, 3. Apr 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
What is hard about writing
Sun, 01/15/2017 - 20:35

What is hard about writing boolean hasCollided; ?