Started by
gustavowizard123
on
Topic category: Help with Minecraft modding (Java Edition)
guys im trying to make my water mob here to die in land (air) and to swim faster (using dolphin grace), i got 2 update ticks here, but when i use both on the code i got errors (cant use both of the same type) and when i try to merge only one of them work; these are the 2 parts i want to join:
PART 1 (Fish die on land):
protected void updateAir(int p_209207_1_) {
if (this.isAlive() && !this.isInWaterOrBubbleColumn()) {
this.setAir(p_209207_1_ - 1);
if (this.getAir() == -20) {
this.setAir(0);
this.attackEntityFrom(DamageSource.DROWN, 2.0F);
}
} else {
this.setAir(300);
}
}
public void baseTick() {
int i = this.getAir();
super.baseTick();
this.updateAir(i);
}
PART 2 (fish swim faster): - its a procedure this one
@Override
public void baseTick() {
super.baseTick();
int x = (int) this.getPosX();
int y = (int) this.getPosY();
int z = (int) this.getPosZ();
Entity entity = this;
{
java.util.HashMap<String, Object> $_dependencies = new java.util.HashMap<>();
$_dependencies.put("entity", entity);
PenguinGentooOnEntityTickUpdateProcedure.executeProcedure($_dependencies);
}
}
why do you need to code this... you can literally check for air and/or give potion effects with procedures...
i can make the 1st code on procedure? cool but i dont know how, sounds complicated :O
yeah, just do on mob tick update trigger, check for block at x y z and x y+1 z (for 2 block tall mobs), and if the blocks are air, deal damage to entity
i did just like that and my world crashed even before loading :/
top part works ok
drowning damage doesn't work on ocean mobs lmao
switch the damage type to generic or something
yeah i did it aint work anyway (it crashes the game before i create the world), i must be missing something here...
and strangly, drown damage do damage water mobs, look this code here on shark:
i tried now as a separete procedure but nothing happens, i think its not that simple as i tought
i replace 'while do' for 'if do', and it works, (while was crashing the game on super fast loops i guess), but now all i can do is kill the mob in 1 blow..hum..
it worked like that, almost perfect:
the only variable that i cant reach here is the Time betheewen the repeat loops there, its very fast, when i open the code i see this suspicious '-1' there, anybody can explain me what it is?
I assume it takes away 1 from the health.