This commit is contained in:
cyberpwn 2022-01-13 07:16:07 -05:00
parent 32a0fc9b17
commit 7e45c17078
4 changed files with 3 additions and 91 deletions

View File

@ -330,6 +330,7 @@ public class Form {
suffix = "Month";
div = 12;
//noinspection IfStatementWithIdenticalBranches
if(phantom > div) {
phantom /= div;
suffix = "Year";

View File

@ -75,6 +75,7 @@ public class MemoryMonitor {
return usedMemory / (double) getMaxBytes();
}
@SuppressWarnings("IfStatementWithIdenticalBranches")
private void sample() {
long used = getVMUse();
if(usedMemory == -1) {

View File

@ -1,91 +0,0 @@
/*
* Iris is a World Generator for Minecraft Bukkit Servers
* Copyright (c) 2022 Arcane Arts (Volmit Software)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package com.volmit.iris.util.hunk.bits;
import com.volmit.iris.Iris;
import com.volmit.iris.util.collection.KList;
import com.volmit.iris.util.collection.KSet;
import com.volmit.iris.util.format.Form;
import com.volmit.iris.util.math.RNG;
import com.volmit.iris.util.matter.slices.BlockMatter;
import org.bukkit.Material;
import org.bukkit.block.data.BlockData;
import java.io.ByteArrayInputStream;
import java.io.DataInputStream;
import java.util.Arrays;
import java.util.Set;
public class TecTest {
public static Set<BlockData> randomBlocks(int max) {
KSet<BlockData> d = new KSet<>();
while(d.size() < max) {
Material m = Material.values()[RNG.r.i(Material.values().length - 1)];
if(m.isBlock()) {
d.add(m.createBlockData());
}
}
return d;
}
public static void go() {
}
public static boolean test(int size, int pal) {
try {
Iris.info("Test? " + size + " " + pal);
KList<BlockData> blocks = new KList<>(randomBlocks(pal));
Iris.info("Fill " + pal + " -> " + size + " Entries");
Writable<BlockData> writer = new BlockMatter();
DataContainer<BlockData> dc = new DataContainer<>(writer, size);
for(int i = 0; i < dc.size(); i++) {
dc.set(i, blocks.getRandom());
}
Iris.info(dc.toString());
byte[] dat = dc.write();
DataContainer<BlockData> dx = new DataContainer<>(new DataInputStream(new ByteArrayInputStream(dat)), writer);
Iris.info(dx.toString());
byte[] dat2 = dx.write();
Iris.info("Size: " + Form.memSize(dat.length, 2) + " -> " + Form.memSize(dat2.length, 2));
if(Arrays.equals(dat, dat2)) {
Iris.info("MATCH");
return true;
} else {
for(int i = 0; i < dc.size(); i++) {
if(!dx.get(i).equals(dc.get(i))) {
Iris.info("FAIL Expected " + dc.get(i).getAsString(true) + " but got " + dx.get(i).getAsString(true));
return false;
}
}
Iris.info("MATCH but different output?");
return true;
}
} catch(Throwable e) {
e.printStackTrace();
return false;
}
}
}

View File

@ -234,6 +234,7 @@ public class VolmitSender implements CommandSender {
}
public void sendProgress(double percent, String thing) {
//noinspection IfStatementWithIdenticalBranches
if(percent < 0) {
int l = 44;
int g = (int) (1D * l);