feat: integrate Beta 1.0.2.0 Pillager update with paid raid recovery
All checks were successful
DuneRealms Plugin CI / plugins (push) Successful in 3m8s
All checks were successful
DuneRealms Plugin CI / plugins (push) Successful in 3m8s
This commit is contained in:
parent
3485eec4a1
commit
c599b2b708
1 changed files with 4107 additions and 23 deletions
|
|
@ -38,6 +38,15 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
private static final String[] PLANETS = {"arrakis", "giedi_prime", "kaitain", "caladan", "sigma_draconis_iv"};
|
||||
|
||||
private NamespacedKey sietchLootIdKey;
|
||||
final SpiceDepositProvenance spiceProvenance=new SpiceDepositProvenance();
|
||||
public boolean isGeneratedSpiceDeposit(Block block){return block!=null&&block.getWorld().getName().equals("arrakis")&&SpiceDepositProvenance.authentic(block);}
|
||||
@EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) public void placedSpice(org.bukkit.event.block.BlockPlaceEvent event){if(event.getBlock().getWorld().getName().equals("arrakis")){SpiceDepositProvenance.forget(event.getBlock());SpiceDepositProvenance.invalidateBloom(event.getBlock());}}
|
||||
@EventHandler public void spiceChunkPopulated(org.bukkit.event.world.ChunkPopulateEvent event){if(event.getWorld().getName().equals("arrakis"))spiceProvenance.commitBloom(event.getChunk());}
|
||||
@EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) public void brokenBloom(org.bukkit.event.block.BlockBreakEvent event){if(event.getBlock().getWorld().getName().equals("arrakis"))SpiceDepositProvenance.invalidateBloom(event.getBlock());}
|
||||
@EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) public void movedBloom(org.bukkit.event.block.BlockPistonExtendEvent event){for(Block block:event.getBlocks())if(block.getWorld().getName().equals("arrakis"))SpiceDepositProvenance.invalidateBloom(block);}
|
||||
@EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) public void retractedBloom(org.bukkit.event.block.BlockPistonRetractEvent event){for(Block block:event.getBlocks())if(block.getWorld().getName().equals("arrakis"))SpiceDepositProvenance.invalidateBloom(block);}
|
||||
@EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) public void explodedBloom(org.bukkit.event.entity.EntityExplodeEvent event){for(Block block:event.blockList())if(block.getWorld().getName().equals("arrakis"))SpiceDepositProvenance.invalidateBloom(block);}
|
||||
@EventHandler(priority=org.bukkit.event.EventPriority.MONITOR,ignoreCancelled=true) public void changedBloom(org.bukkit.event.entity.EntityChangeBlockEvent event){if(event.getBlock().getWorld().getName().equals("arrakis"))SpiceDepositProvenance.invalidateBloom(event.getBlock());}
|
||||
private final Map<UUID, PersonalLoot> openSietchLoot = new HashMap<>();
|
||||
private record PersonalLoot(Inventory inventory, String id) {}
|
||||
|
||||
|
|
@ -124,6 +133,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
|
||||
private void detonateSpiceBlow(Block center) {
|
||||
if (center.getType() != Material.MAGMA_BLOCK) return;
|
||||
boolean authenticatedBloom=SpiceDepositProvenance.takeBloom(center);
|
||||
World world = center.getWorld();
|
||||
int x = center.getX(), z = center.getZ(), baseY = center.getY() - 1;
|
||||
for (int dx = -1; dx <= 1; dx++) for (int dz = -1; dz <= 1; dz++)
|
||||
|
|
@ -154,6 +164,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
for (Block block : candidates) {
|
||||
if (placed >= targetDeposits) break;
|
||||
block.setType(Material.SUSPICIOUS_SAND, false);
|
||||
if(authenticatedBloom)SpiceDepositProvenance.mark(block.getState());
|
||||
placed++;
|
||||
}
|
||||
announceSpiceBloom(center.getLocation());
|
||||
|
|
@ -367,7 +378,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
PlanetChunkGenerator(DuneTerrain plugin, String planet) { this.plugin = plugin; this.planet = planet; }
|
||||
@Override public List<BlockPopulator> getDefaultPopulators(World world) {
|
||||
return planet.equals("arrakis") && world.getName().equalsIgnoreCase("arrakis")
|
||||
? List.of(new SietchPopulator(plugin), new SpiceBlowPopulator(plugin), new DesertVillages(plugin), new HarkonnenFortress(plugin)) : List.of();
|
||||
? List.of(new SietchPopulator(plugin), new SpiceBlowPopulator(plugin), new DesertVillages(plugin), new HarkonnenFortress(plugin),plugin.spiceProvenance) : List.of();
|
||||
}
|
||||
@Override public void generateNoise(WorldInfo world, Random random, int chunkX, int chunkZ, ChunkData data) {
|
||||
if(TemperateLandscape.enabled(planet)){
|
||||
|
|
@ -420,10 +431,11 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
}
|
||||
boolean arrakisWorld = planet.equals("arrakis") && world.getName().equalsIgnoreCase("arrakis");
|
||||
if (arrakisWorld) placeOasisTree(data, chunkX, chunkZ, heights, minY, maxY);
|
||||
var emittedSpice=new ArrayList<SpiceDepositProvenance.Position>();
|
||||
if (arrakisWorld) {
|
||||
placeDarkstoneIsland(data, chunkX, chunkZ, heights, minY, maxY);
|
||||
placeSpiceDeposits(data, heights, random, minY, maxY);
|
||||
placeRandomSpicePatch(data, chunkX, chunkZ, heights);
|
||||
placeSpiceDeposits(data, heights, random, minY, maxY,emittedSpice);
|
||||
placeRandomSpicePatch(data, chunkX, chunkZ, heights,emittedSpice);
|
||||
if (plugin.getConfig().getBoolean("dense-spice.enabled", true)) {
|
||||
int spacing = Math.max(128, plugin.getConfig().getInt("dense-spice.spacing", 512));
|
||||
for (int x=0;x<16;x++) for(int z=0;z<16;z++)
|
||||
|
|
@ -432,6 +444,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
}
|
||||
}
|
||||
placeOres(data, random, path, minY, maxY);
|
||||
if(arrakisWorld&&plugin.spiceProvenance!=null)plugin.spiceProvenance.capture(world,chunkX,chunkZ,emittedSpice,data);
|
||||
}
|
||||
@Override public BiomeProvider getDefaultBiomeProvider(WorldInfo worldInfo) {
|
||||
return new PlanetBiomeProvider(plugin, planet);
|
||||
|
|
@ -548,16 +561,16 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
Material material = Material.matchMaterial(name == null ? "" : name);
|
||||
return material == null ? fallback : material;
|
||||
}
|
||||
private void placeSpiceDeposits(ChunkData data, int[][] heights, Random random, int minY, int maxY) {
|
||||
private void placeSpiceDeposits(ChunkData data, int[][] heights, Random random, int minY, int maxY,List<SpiceDepositProvenance.Position> emitted) {
|
||||
int count = Math.max(0, plugin.getConfig().getInt("spice-deposits.per-chunk", 2));
|
||||
for (int i = 0; i < count; i++) {
|
||||
int x = random.nextInt(16), z = random.nextInt(16), y = heights[x][z];
|
||||
Material surface = data.getType(x, y, z);
|
||||
if (y + 1 < maxY && y > minY && (surface == Material.SAND || surface == Material.RED_SAND))
|
||||
data.setBlock(x, y, z, Material.SUSPICIOUS_SAND);
|
||||
if (y + 1 < maxY && y > minY && (surface == Material.SAND || surface == Material.RED_SAND)){
|
||||
data.setBlock(x, y, z, Material.SUSPICIOUS_SAND);emitted.add(new SpiceDepositProvenance.Position(x,y,z));}
|
||||
}
|
||||
}
|
||||
private void placeRandomSpicePatch(ChunkData data, int chunkX, int chunkZ, int[][] heights) {
|
||||
private void placeRandomSpicePatch(ChunkData data, int chunkX, int chunkZ, int[][] heights,List<SpiceDepositProvenance.Position> emitted) {
|
||||
String path = "spice-deposits.patches.";
|
||||
if (!plugin.getConfig().getBoolean(path + "enabled", true)) return;
|
||||
int spacing = Math.max(128, plugin.getConfig().getInt(path + "region-spacing", 600));
|
||||
|
|
@ -585,7 +598,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
if (hashUnit(blockSeed) >= density) continue;
|
||||
int y = heights[x][z];
|
||||
if (data.getType(x, y, z) == Material.SAND || data.getType(x, y, z) == Material.RED_SAND)
|
||||
data.setBlock(x, y, z, Material.SUSPICIOUS_SAND);
|
||||
{data.setBlock(x, y, z, Material.SUSPICIOUS_SAND);emitted.add(new SpiceDepositProvenance.Position(x,y,z));}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -947,6 +960,7 @@ public final class DuneTerrain extends JavaPlugin implements Listener {
|
|||
for (int dx = -1; dx <= 1; dx++) for (int dz = -1; dz <= 1; dz++)
|
||||
if (region.isInRegion(x + dx, y, z + dz)) region.setType(x + dx, y, z + dz, Material.MAGMA_BLOCK);
|
||||
if (region.isInRegion(x, y + 1, z)) region.setType(x, y + 1, z, Material.MAGMA_BLOCK);
|
||||
if(plugin.spiceProvenance!=null)plugin.spiceProvenance.bloom(world,chunkX,chunkZ,new SpiceDepositProvenance.Position(x,y+1,z));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue

Staff