Further optimizations to Lava Plume creation.
This commit is contained in:
parent
f3fdcdfc38
commit
1a1131d499
Binary file not shown.
@ -26,8 +26,8 @@ public class BlockModifyQueue{
|
|||||||
this.b=b;
|
this.b=b;
|
||||||
this.checktype=checktype;
|
this.checktype=checktype;
|
||||||
this.finaltype=finaltype;
|
this.finaltype=finaltype;
|
||||||
this.checkdata=0;
|
this.checkdata=checkdata;
|
||||||
this.finaldata=0;
|
this.finaldata=finaldata;
|
||||||
this.usedata=true;
|
this.usedata=true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import org.inventivetalent.glow.GlowAPI;
|
|||||||
import net.minecraft.server.v1_9_R1.EnumParticle;
|
import net.minecraft.server.v1_9_R1.EnumParticle;
|
||||||
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
import sig.plugin.TwosideKeeper.TwosideKeeper;
|
||||||
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
|
import sig.plugin.TwosideKeeper.aPluginAPIWrapper;
|
||||||
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
|
||||||
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
import sig.plugin.TwosideKeeper.HelperStructures.Utils.SoundUtils;
|
||||||
|
|
||||||
public class LavaPlume {
|
public class LavaPlume {
|
||||||
@ -85,14 +86,16 @@ public class LavaPlume {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (fb.getLocation().getY()>lavayreached) {
|
if (fb.getLocation().getY()>lavayreached) {
|
||||||
|
int tickdelay=0;
|
||||||
for (int y=lavayreached;y<fb.getLocation().getY();y++) {
|
for (int y=lavayreached;y<fb.getLocation().getY();y++) {
|
||||||
//Set the 4 blocks around it to lava.
|
//Set the 4 blocks around it to lava.
|
||||||
List<Block> blocklist = new ArrayList<Block>();
|
List<Block> blocklist = new ArrayList<Block>();
|
||||||
int rely = (int)(y-fb.getLocation().getY());
|
int rely = (int)(y-fb.getLocation().getY());
|
||||||
if (state1 && !UpdateLavaBlock(fb.getLocation().add(1,rely,0).getBlock())) {state1=false;}
|
if (state1 && !UpdateLavaBlock(fb.getLocation().add(1,rely,0).getBlock(),tickdelay)) {state1=false;}
|
||||||
if (state2 && !UpdateLavaBlock(fb.getLocation().add(-1,rely,0).getBlock())) {state2=false;}
|
if (state2 && !UpdateLavaBlock(fb.getLocation().add(-1,rely,0).getBlock(),tickdelay)) {state2=false;}
|
||||||
if (state3 && !UpdateLavaBlock(fb.getLocation().add(0,rely,1).getBlock())) {state3=false;}
|
if (state3 && !UpdateLavaBlock(fb.getLocation().add(0,rely,1).getBlock(),tickdelay)) {state3=false;}
|
||||||
if (state4 && !UpdateLavaBlock(fb.getLocation().add(0,rely,-1).getBlock())) {state4=false;}
|
if (state4 && !UpdateLavaBlock(fb.getLocation().add(0,rely,-1).getBlock(),tickdelay)) {state4=false;}
|
||||||
|
tickdelay++;
|
||||||
}
|
}
|
||||||
lavayreached=(int)fb.getLocation().getY();
|
lavayreached=(int)fb.getLocation().getY();
|
||||||
} else
|
} 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.getType()==Material.LAVA) {
|
||||||
|
Bukkit.getScheduler().scheduleSyncDelayedTask(TwosideKeeper.plugin, ()->{
|
||||||
if (lavamod.getType()==Material.AIR) {
|
if (lavamod.getType()==Material.AIR) {
|
||||||
lavamod.setType(Material.LAVA);
|
lavamod.setType(Material.LAVA);
|
||||||
lavamod.setData((byte)8);
|
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));
|
this.lavablocks.add(new TemporaryLava(lavamod,(int)(3*fb.getVelocity().getY())+6));
|
||||||
if (Math.random()<=0.1) {
|
if (Math.random()<=0.1) {
|
||||||
SoundUtils.playGlobalSound(lavamod.getLocation(), Sound.ENTITY_BLAZE_SHOOT, 0.6f, 0.6f);
|
SoundUtils.playGlobalSound(lavamod.getLocation(), Sound.ENTITY_BLAZE_SHOOT, 0.6f, 0.6f);
|
||||||
|
@ -3,13 +3,16 @@ package sig.plugin.TwosideKeeper;
|
|||||||
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
|
import sig.plugin.TwosideKeeper.HelperStructures.Common.BlockModifyQueue;
|
||||||
|
|
||||||
public class runServerTick implements Runnable{
|
public class runServerTick implements Runnable{
|
||||||
|
final int queuespd = 3;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
|
for (int i=queuespd;i>0;i--) {
|
||||||
if (TwosideKeeper.blockqueue.size()>0) {
|
if (TwosideKeeper.blockqueue.size()>0) {
|
||||||
BlockModifyQueue bmq = TwosideKeeper.blockqueue.remove(0);
|
BlockModifyQueue bmq = TwosideKeeper.blockqueue.remove(0);
|
||||||
bmq.run();
|
bmq.run();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user