Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @SubscribeEvent
- public void tickupdate(TickEvent evt) {
- Random myrandomgen = new Random();
- for (Entity ee : entitylist) {
- boolean ground = false;
- if (!ee.isDead) {
- double lastposx = ee.lastTickPosX;
- double lastposy = ee.lastTickPosY;
- double lastposz = ee.lastTickPosZ;
- double currentx = ee.posX;
- double currenty = ee.posY;
- double currentz = ee.posZ;
- double diffx = 0;
- double diffy = 0;
- double diffz = 0;
- boolean differencemajor = false;
- //Get difference in X since last Tick
- if (lastposx > currentx) {
- diffx = lastposx - currentx;
- }
- if (currentx > lastposx) {
- diffx = currentx - lastposx;
- }
- //Get difference in Y since last Tick
- if (lastposy > currenty) {
- diffy = lastposy - currenty;
- }
- if (currenty > lastposy) {
- diffy = currenty - lastposy;
- }
- //Get difference in Z since last Tick
- if (lastposz > currentz) {
- diffz = lastposz - currentz;
- }
- if (currentz > lastposz) {
- diffz = currentz - lastposz;
- }
- if (diffx < 1) {
- if (diffy < 1) {
- if (diffz < 1) {
- differencemajor = true;
- }
- }
- }
- if (thisplayer != null) {
- if (thisplayer.getEntityWorld().isRemote == false) {
- if (differencemajor == true) {
- EntitySpider tntentity;
- net.minecraft.entity.Entity thisarrow;
- net.minecraft.world.World world;
- world = ee.getEntityWorld();
- thisarrow = ee;
- tntentity = new EntitySpider(thisplayer.getEntityWorld());
- tntentity.setLocationAndAngles(ee.posX, ee.posY, ee.posZ, 0, 0);
- world.spawnEntityInWorld(tntentity);
- for (int a=1;a<300;a++){
- int posx = myrandomgen.nextInt(200);
- int posy = myrandomgen.nextInt(30);
- int posz = myrandomgen.nextInt(200);
- double newx = (double)posx + ee.posX;
- double newy = (double)posy + ee.posY;
- double newz = (double)posz + ee.posZ;
- tntentity = new EntitySpider(thisplayer.getEntityWorld());
- tntentity.setLocationAndAngles(newx, newy, newz, 0, 0);
- world.spawnEntityInWorld(tntentity);
- }
- ee.setDead();
- }
- }
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement