Merge pull request #821 from VolmitSoftware/Development

Development
This commit is contained in:
Brian Fopiano 2022-07-07 14:23:57 -07:00 committed by GitHub
commit f52cd29e7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 22 additions and 72 deletions

View File

@ -24,7 +24,7 @@ plugins {
id "de.undercouch.download" version "5.0.1"
}
version '2.2.2-1.19' // Needs to be version specific
version '2.2.3-1.19' // Needs to be version specific
def nmsVersion = "1.19"
def apiVersion = '1.19'
def spigotJarVersion = '1.19-R0.1-SNAPSHOT'

View File

@ -30,6 +30,7 @@ import com.volmit.iris.util.format.C;
import com.volmit.iris.util.io.IO;
import com.volmit.iris.util.plugin.VolmitSender;
import com.volmit.iris.util.scheduling.J;
import com.volmit.iris.util.scheduling.Queue;
import org.bukkit.Bukkit;
import org.bukkit.configuration.InvalidConfigurationException;
import org.bukkit.configuration.file.FileConfiguration;
@ -38,6 +39,7 @@ import org.bukkit.entity.Player;
import java.io.File;
import java.io.IOException;
import java.util.List;
import java.util.concurrent.TimeUnit;
public class ServerConfigurator {
@ -82,43 +84,21 @@ public class ServerConfigurator {
}
}
private static File getDatapacksFolder() {
private static List<File> getDatapacksFolder() {
if(!IrisSettings.get().getGeneral().forceMainWorld.isEmpty()) {
return new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks");
return new KList<File>().qadd(new File(IrisSettings.get().getGeneral().forceMainWorld + "/datapacks"));
}
File props = new File("server.properties");
if(props.exists()) {
try {
KList<String> m = new KList<>(IO.readAll(props).split("\\Q\n\\E"));
for(String i : m) {
if(i.trim().startsWith("level-name=")) {
return new File(i.trim().split("\\Q=\\E")[1] + "/datapacks");
}
}
} catch(IOException e) {
Iris.reportError(e);
e.printStackTrace();
}
}
return null;
KList<File> worlds = new KList<>();
Bukkit.getServer().getWorlds().forEach(w -> worlds.add(new File(w.getWorldFolder(), "datapacks")));
return worlds;
}
public static void installDataPacks(boolean fullInstall) {
Iris.info("Checking Data Packs...");
boolean reboot = false;
File packs = new File("plugins/Iris/packs");
File dpacks = getDatapacksFolder();
if(dpacks == null) {
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
return;
}
if(packs.exists()) {
if(packs.exists()) {
for(File i : packs.listFiles()) {
if(i.isDirectory()) {
Iris.verbose("Checking Pack: " + i.getPath());
@ -135,8 +115,8 @@ public class ServerConfigurator {
}
Iris.verbose(" Checking Dimension " + dim.getLoadFile().getPath());
if(dim.installDataPack(() -> data, dpacks)) {
reboot = true;
for(File dpack : getDatapacksFolder()) {
dim.installDataPack(() -> data, dpack);
}
}
}
@ -147,19 +127,12 @@ public class ServerConfigurator {
Iris.info("Data Packs Setup!");
if(fullInstall) {
if(fullInstall)
verifyDataPacksPost(IrisSettings.get().getAutoConfiguration().isAutoRestartOnCustomBiomeInstall());
}
}
private static void verifyDataPacksPost(boolean allowRestarting) {
File packs = new File("plugins/Iris/packs");
File dpacks = getDatapacksFolder();
if(dpacks == null) {
Iris.error("Cannot find the datapacks folder! Please try generating a default world first maybe? Is this a new server?");
return;
}
boolean bad = false;
if(packs.exists()) {

View File

@ -344,44 +344,12 @@ public class NMSBinding19_1 implements INMSBinding {
ChunkAccess s = (ChunkAccess) getFieldForBiomeStorage(chunk).get(chunk);
Holder<net.minecraft.world.level.biome.Biome> biome = (Holder<net.minecraft.world.level.biome.Biome>) somethingVeryDirty;
s.setBiome(x, y, z, biome);
/*int l = QuartPos.fromBlock(s.getMinBuildHeight());
int i1 = l + QuartPos.fromBlock(s.getHeight()) - 1;
PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>> palette = getPalette(s, s.getSectionIndex(QuartPos.toBlock(Mth.clamp(y, l, i1))));
int index = getPaletteIndex(x, y, z, s, palette);
int data = getPaletteDataId(palette, biome);
setPaletteData(palette, index, data);*/
} catch(IllegalAccessException e) {
Iris.reportError(e);
e.printStackTrace();
}
}
private PalettedContainer<Holder<net.minecraft.world.level.biome.Biome>> getPalette(ChunkAccess ca, int index) {
LevelChunkSection[] sections = fieldForClass(LevelChunkSection[].class, ChunkAccess.class, ca);
return fieldForClass(PalettedContainer.class, LevelChunkSection.class, sections[index]);
}
private int getPaletteIndex(int x, int y, int z, ChunkAccess s, PalettedContainer<?> palette) {
int l = QuartPos.fromBlock(s.getMinBuildHeight());
int i1 = l + QuartPos.fromBlock(s.getHeight()) - 1;
int j1 = Mth.clamp(y, l, i1);
return fieldForClass(PalettedContainer.Strategy.class, PalettedContainer.class, palette).getIndex(x & 3, j1 & 3, z & 3);
}
private <T extends Holder<?>> int getPaletteDataId(PalettedContainer<T> palette, T data) throws ClassNotFoundException {
Class<?> dataType = getClassType(PalettedContainer.class, 1);
Object paletteData = fieldFor(dataType, palette);
Palette<T> fuckinFinally = fieldForClass(Palette.class,dataType, paletteData);
return fuckinFinally.idFor(data);
}
private void setPaletteData(PalettedContainer<?> palette, int index, int data) throws ClassNotFoundException {
Class<?> dataType = getClassType(PalettedContainer.class, 1);
Object paletteData = fieldFor(dataType, palette);
BitStorage storage = fieldForClass(BitStorage.class, dataType, paletteData);
storage.set(index, data);
}
private Field getFieldForBiomeStorage(Object storage) {
Field f = biomeStorageCache;

View File

@ -27,6 +27,7 @@ import com.volmit.iris.engine.object.IrisBiome;
import com.volmit.iris.engine.object.IrisBiomeCustom;
import com.volmit.iris.util.documentation.BlockCoordinates;
import com.volmit.iris.util.hunk.Hunk;
import com.volmit.iris.util.hunk.view.BiomeGridHunkHolder;
import com.volmit.iris.util.hunk.view.BiomeGridHunkView;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.parallel.BurstExecutor;
@ -56,6 +57,14 @@ public class IrisBiomeActuator extends EngineAssignedActuator<Biome> {
hh.forceBiomeBaseInto(x, y, z, bb);
}
return true;
} else if(h instanceof BiomeGridHunkHolder hh) {
ChunkGenerator.BiomeGrid g = hh.getChunk();
if(g instanceof TerrainChunk) {
((TerrainChunk) g).getBiomeBaseInjector().setBiome(x, y, z, bb);
} else {
hh.forceBiomeBaseInto(x, y, z, bb);
}
return true;
}
} catch(Throwable e) {
e.printStackTrace();