Further optimizations to Lava Plume creation.

testdev
sigonasr2 8 years ago
parent f3fdcdfc38
commit 1a1131d499
  1. BIN
      TwosideKeeper.jar
  2. 4
      src/sig/plugin/TwosideKeeper/HelperStructures/Common/BlockModifyQueue.java
  3. 24
      src/sig/plugin/TwosideKeeper/HelperStructures/Effects/LavaPlume.java
  4. 9
      src/sig/plugin/TwosideKeeper/runServerTick.java

Binary file not shown.

@ -26,8 +26,8 @@ public class BlockModifyQueue{
this.b=b;
this.checktype=checktype;
this.finaltype=finaltype;
this.checkdata=0;
this.finaldata=0;
this.checkdata=checkdata;
this.finaldata=finaldata;
this.usedata=true;
}

@ -20,6 +20,7 @@ import org.inventivetalent.glow.GlowAPI;
import net.minecraft.server.v1_9_R1.EnumParticle;
import sig.plugin.TwosideKeeper.TwosideKeeper;
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
public class LavaPlume {
@ -85,14 +86,16 @@ public class LavaPlume {
}
} else {
if (fb.getLocation().getY()>lavayreached) {
int tickdelay=0;
for (int y=lavayreached;y<fb.getLocation().getY();y++) {
//Set the 4 blocks around it to lava.
List<Block> blocklist = new ArrayList<Block>();
int rely = (int)(y-fb.getLocation().getY());
if (state1 && !UpdateLavaBlock(fb.getLocation().add(1,rely,0).getBlock())) {state1=false;}
if (state2 && !UpdateLavaBlock(fb.getLocation().add(-1,rely,0).getBlock())) {state2=false;}
if (state3 && !UpdateLavaBlock(fb.getLocation().add(0,rely,1).getBlock())) {state3=false;}
if (state4 && !UpdateLavaBlock(fb.getLocation().add(0,rely,-1).getBlock())) {state4=false;}
if (state1 && !UpdateLavaBlock(fb.getLocation().add(1,rely,0).getBlock(),tickdelay)) {state1=false;}
if (state2 && !UpdateLavaBlock(fb.getLocation().add(-1,rely,0).getBlock(),tickdelay)) {state2=false;}
if (state3 && !UpdateLavaBlock(fb.getLocation().add(0,rely,1).getBlock(),tickdelay)) {state3=false;}
if (state4 && !UpdateLavaBlock(fb.getLocation().add(0,rely,-1).getBlock(),tickdelay)) {state4=false;}
tickdelay++;
}
lavayreached=(int)fb.getLocation().getY();
} else
@ -103,12 +106,15 @@ public class LavaPlume {
}
}
private boolean UpdateLavaBlock(Block lavamod) {
private boolean UpdateLavaBlock(Block lavamod,int tickdelay) {
if (lavamod.getType()==Material.AIR || lavamod.getType()==Material.LAVA) {
if (lavamod.getType()==Material.AIR) {
lavamod.setType(Material.LAVA);
lavamod.setData((byte)8);
}
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
if (lavamod.getType()==Material.AIR) {
lavamod.setType(Material.LAVA);
lavamod.setData((byte)8);
//TwosideKeeper.blockqueue.add(new BlockModifyQueue(lavamod,Material.AIR,(byte)0,Material.LAVA,(byte)8));
}
},tickdelay);
this.lavablocks.add(new TemporaryLava(lavamod,(int)(3*fb.getVelocity().getY())+6));
if (Math.random()<=0.1) {
SoundUtils.playGlobalSound(lavamod.getLocation(), Sound.ENTITY_BLAZE_SHOOT, 0.6f, 0.6f);

@ -3,12 +3,15 @@ package sig.plugin.TwosideKeeper;
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
public class runServerTick implements Runnable{
final int queuespd = 3;
@Override
public void run() {
if (TwosideKeeper.blockqueue.size()>0) {
BlockModifyQueue bmq = TwosideKeeper.blockqueue.remove(0);
bmq.run();
for (int i=queuespd;i>0;i--) {
if (TwosideKeeper.blockqueue.size()>0) {
BlockModifyQueue bmq = TwosideKeeper.blockqueue.remove(0);
bmq.run();
}
}
}

Loading…
Cancel
Save