Code question

Dieses Thema im Forum "Community Talk" wurde erstellt von tyler489, 16. Mai 2016.

  1. tyler489

    tyler489 Well-Known Member

    Beiträge:
    1.873
    Zustimmungen:
    202
    Ortszeit:
    09:29
    so i was looking into the galacticraft creeper boss code trying to figure out any way to damage it other than returning the tnt it shoots at u and i found this
    Code:
    	@Override
    	public boolean attackEntityFrom(DamageSource damageSource, float damage)
    	{
    		if (damageSource.getDamageType().equals("fireball"))
    		{
    			if (this.isEntityInvulnerable())
    			{
    				return false;
    			}
    			else if (super.attackEntityFrom(damageSource, damage))
    			{
    				Entity entity = damageSource.getEntity();
    
    				if (this.riddenByEntity != entity && this.ridingEntity != entity)
    				{
    					if (entity != this)
    					{
    						this.entityToAttack = entity;
    					}
    
    					return true;
    				}
    				else
    				{
    					return true;
    				}
    			}
    			else
    			{
    				return false;
    			}
    		}
    
    		return false;
    	}
    does this mean i can damage it with fireballs?
     
  2. chugga_fan

    chugga_fan ME 4M storage cell of knowledge, all the time

    Beiträge:
    5.861
    Zustimmungen:
    730
    Ortszeit:
    10:29
    Yes, fireballs deal damage to the guy apparently
     
  3. tyler489

    tyler489 Well-Known Member

    Beiträge:
    1.873
    Zustimmungen:
    202
    Ortszeit:
    09:29
    im still trying to figure this part out
    Code:
    if (this.riddenByEntity != entity && this.ridingEntity != entity)
    				{
    					if (entity != this)
    					{
    						this.entityToAttack = entity;
    					}
    
    					return true;
    returning true makes him invunerable but it seems to be confusing
     
  4. chugga_fan

    chugga_fan ME 4M storage cell of knowledge, all the time

    Beiträge:
    5.861
    Zustimmungen:
    730
    Ortszeit:
    10:29
    there's static entity instantiated somewhere else, and it appears to be multiple mobs to make it, maybe that's why?
     
  5. Matryoshika

    Matryoshika Well-Known Member

    Beiträge:
    1.193
    Zustimmungen:
    606
    Ortszeit:
    16:29
    incorrect;

    Code:
    Entity entity = damageSource.getEntity();
    The one who does the damage unto the creeper.

    Essentially, as far as I can see, if you are riding him, he will not aggro on you, even if hit (by you at least)
     
  6. chugga_fan

    chugga_fan ME 4M storage cell of knowledge, all the time

    Beiträge:
    5.861
    Zustimmungen:
    730
    Ortszeit:
    10:29
    I never saw the source code, so i could only guess ;) but i was correct that it's instansiated somewhere else, but yhea that's right if you're looking at the source
     
  7. tyler489

    tyler489 Well-Known Member

    Beiträge:
    1.873
    Zustimmungen:
    202
    Ortszeit:
    09:29
    hmm ok also found this list of slimelings foods
    gold ingot
    flint and steel
    baked potato
    stone sword
    gunpowder
    door
    emeralds
    cookedfish
    repeater
    boat
     
    Zuletzt bearbeitet: 16. Mai 2016
  8. Matryoshika

    Matryoshika Well-Known Member

    Beiträge:
    1.193
    Zustimmungen:
    606
    Ortszeit:
    16:29
    ?? what?

    btw:
    Returning true in an attackEntityFrom method merely allows him to be hurt. You thought it is the other way around. Returning false means he is not hurt.
     
  9. tyler489

    tyler489 Well-Known Member

    Beiträge:
    1.873
    Zustimmungen:
    202
    Ortszeit:
    09:29
    i was talking about isentityinvunerable method returning false

    the reason i was asking is i was trying to kill the boss on ozone (before the restart and crash)
    and the tnt attack ur suppost to hit back at him is disapearing. like desync it looks like i hit it it goes flying twords the creeper then reverses and exploads
     
  10. Matryoshika

    Matryoshika Well-Known Member

    Beiträge:
    1.193
    Zustimmungen:
    606
    Ortszeit:
    16:29
    Ah, though you also got that wrong ;)
    It checks if he is already invulnerable, if so, any damage is negated. You need to find where that bool is set to true first, to find out how he becomes invulnerable.
     
  11. tyler489

    tyler489 Well-Known Member

    Beiträge:
    1.873
    Zustimmungen:
    202
    Ortszeit:
    09:29
    this.targetTasks.addTask(1, new EntityAIHurtByTarget(this, false));
    this.targetTasks.addTask(2, new EntityAINearestAttackableTarget(this, EntityPlayer.class, 0, true));
    so that makes him invunerable i guess

    Ozone is up but no one can join so i cant test
     
  12. SirWill

    SirWill Founder

    Beiträge:
    12.285
    Zustimmungen:
    3.712
    Ortszeit:
    16:29
    Moved as it is no support request.
     
  13. DrummerBoyNo

    DrummerBoyNo Well-Known Member

    Beiträge:
    61
    Zustimmungen:
    6
    Ortszeit:
    09:29
    Fire balls hurt as well as the boss is actually 4 entities the 3 heads and the legs. Prettmuch any weapon that has a effect like tnt should hurt him.
     

Diese Seite empfehlen