Faire un bloc qui repousse les mobs ?
-
if (event.entityLiving instanceof Entity) { if(event.entityLiving != player) event.entityLiving.setDead(); }en 1.6 je fais comme ca
EDIT: dans l’event:
@ForgeSubscribe
public void onEntityUpdate(LivingUpdateEvent event) { -
Merci Isador mais en fait je veux qu’il soient tués juste dans un rayon autour de mon bloc

-
bha dans l’event tu rajoute une condition
if(entityEstDansMonRayon) { //ici tu met mon code } -
Oui mais comment je fais pour avoir l’instance du bloc ? ^^
-
a oui merde…
sinon dans ton updateTick dans ton bloc appelle la méthode onEntityUpdate
-
Je ne comprends là

-
public void updateTick(World world, int x, int y, int z, Random rand) { onEntityUptate(); } @ForgeSubscribe public void onEntityUpdate(LivingUpdateEvent event) { if (event.entityLiving instanceof Entity) { if(event.entityLiving != player){ event.entityLiving.setDead(); } } } -
Ah bonne idée ! Et ça marche ? Tu pourrais tester s’il te plaît ? (Je n’ai pas Eclipse sur moi)
-
moi non plus… je suis en train de coder sous unity…
-
D’accord merci quand même pour l’idée

-
Non, ça fonctionnera pas …
Perso je passerai plutôt par la fonction update d’un tile entity -
ça me dérange pas mais comment tu ferais toi ?
-
Avec le même code. Dès fois updateTick fonctionne mal …
il y a juste ça :
List list = world.getEntitiesWithinAABB(EntityZombie.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1).expand(16D, 16D, 16D));
Que j’aurai mit comme ça :
List list = world.getEntitiesWithinAABB(EntityZombie.class, AxisAlignedBB.getBoundingBox(x - 16, y - 16, z - 16, x + 17, y + 17, z + 17)); -
Mais je n’ai pas bien compris finalement je fais un tile entity ou pas la peine ?
-
oui, fait un tile entity.
-
D’accord, j’essaye

Oh oui merci beaucoup Robin ça marche, grâce à toi un nouveau mod va voir le jour
Je mets en résolu 