Improve ore performance by caching chunks

This commit is contained in:
dfsek
2020-10-12 00:28:17 -07:00
parent ef16143565
commit 6480fb0bb6
3 changed files with 51 additions and 7 deletions

View File

@@ -3,11 +3,13 @@ package com.dfsek.terra.command;
import com.dfsek.terra.TerraWorld;
import com.dfsek.terra.config.genconfig.OreConfig;
import com.dfsek.terra.config.lang.LangUtil;
import org.bukkit.Location;
import org.bukkit.World;
import org.bukkit.block.Block;
import org.bukkit.command.Command;
import org.bukkit.command.CommandSender;
import org.bukkit.entity.Player;
import org.bukkit.util.Vector;
import org.jetbrains.annotations.NotNull;
import org.polydev.gaea.command.WorldCommand;
@@ -33,7 +35,8 @@ public class OreCommand extends WorldCommand {
LangUtil.send("command.ore.out-of-range", sender);
return true;
}
ore.doVein(bl.getLocation(), new Random());
Vector source = new Vector(Math.floorMod(bl.getX(), 16), bl.getY(), Math.floorMod(bl.getZ(), 16));
ore.doVein(source, bl.getChunk(), new Random());
} else {
LangUtil.send("command.ore.main-menu", sender);
}