From f426e0fb5a6044c1e8c069672e88962bd5053a21 Mon Sep 17 00:00:00 2001 From: QPCrummer <66036033+QPCrummer@users.noreply.github.com> Date: Tue, 9 Jul 2024 21:59:20 -0400 Subject: [PATCH] Cleanup and mod icon - Removed old classes - Improved Readme - Added an icon --- README.md | 24 +++ gradle.properties | 2 +- .../utils/ram_disk/LinuxRamDiskManager.java | 64 -------- .../utils/ram_disk/RamDiskManager.java | 15 -- .../utils/random/SplittableRandomImpl.java | 151 ------------------ .../resources/assets/potatoptimize/icon.png | Bin 0 -> 3617 bytes 6 files changed, 25 insertions(+), 231 deletions(-) delete mode 100644 src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/LinuxRamDiskManager.java delete mode 100644 src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/RamDiskManager.java delete mode 100644 src/main/java/com/github/tatercertified/potatoptimize/utils/random/SplittableRandomImpl.java create mode 100644 src/main/resources/assets/potatoptimize/icon.png diff --git a/README.md b/README.md index 2af7afb..8905fa3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,26 @@ # Potatoptimize Let Tater optimize your game! It may be more potato than vanilla when it is done! + +--- + +## About Potatoptimize +This is an **experimental** optimization mod that pools optimizations from PaperMC, Gale, Mirai, Velocity, Yatopia, Jettpack, Leaf, and many more sources, as well as my own optimizations. +While the majority of the optimizations are for servers, there are a few that apply only to the client. That being said, all the server optimizations can apply to the client in singleplayer. +This mod *does not* intend to respect vanilla parity, however in general the differences with and without this mod are very minor. + +## Here be taters! +This mod is very early in development. Expect bugs and report bugs, please and thanks. The only way giant mods like this can be improved is from the support of the community and testers. If you find a bug, please report it on the Github Issue Tracker. + +## Can I have it on (Neo)Forge? +Hmm... we'll see, but tater doesn't like Forge. + +--- + +## Downloads +[Modrinth](https://modrinth.com/mod/potatoptimize) + +[Github](https://github.com/Tater-Certified/Potatoptimize/releases) + +--- + +### Join our [Discord](https://discord.gg/XGw3Te7QYr)! diff --git a/gradle.properties b/gradle.properties index cd628ff..ff15786 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.15.11 # Mod Properties - mod_version = 0.0.1-dev.5 + mod_version = 0.0.1-dev.6 maven_group = com.github.tatercertified archives_base_name = potatoptimize diff --git a/src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/LinuxRamDiskManager.java b/src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/LinuxRamDiskManager.java deleted file mode 100644 index a7d7d4f..0000000 --- a/src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/LinuxRamDiskManager.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.github.tatercertified.potatoptimize.utils.ram_disk; - -import com.google.common.cache.CacheBuilder; -import com.google.common.cache.CacheLoader; -import com.google.common.cache.LoadingCache; -import net.minecraft.world.storage.RegionFile; -import org.jetbrains.annotations.NotNull; - -import java.io.File; - -public class LinuxRamDiskManager implements RamDiskManager{ - private int size; - private String mountPath; - private CacheLoader cacheLoader; - private LoadingCache cache; - - public LinuxRamDiskManager() { - } - @Override - public void createRamDisk(int size, String mountPath) { - - if (this.cache != null) { - removeRamDisk(); - } - - this.cacheLoader = new CacheLoader<>() { - @Override - public @NotNull RegionFile load(int @NotNull [] key) { - return null; - } - }; - this.cache = CacheBuilder.newBuilder().build(this.cacheLoader); - } - - @Override - public void removeRamDisk() { - this.cache.invalidateAll(); - this.cache = null; - } - - @Override - public void uploadFile(RegionFile file) { - this.cache.put(null, file); - } - - @Override - public void removeFile(RegionFile file) { - this.cache.invalidate(null); - } - - @Override - public int getRamDiskSize() { - return this.size; - } - - @Override - public RegionFile[] getRamDiskFiles() { - return this.cache.asMap().values().toArray(new RegionFile[0]); - } - - @Override - public void adjustRamDiskSize(int newSize) { - } -} diff --git a/src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/RamDiskManager.java b/src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/RamDiskManager.java deleted file mode 100644 index 54f6051..0000000 --- a/src/main/java/com/github/tatercertified/potatoptimize/utils/ram_disk/RamDiskManager.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.github.tatercertified.potatoptimize.utils.ram_disk; - -import net.minecraft.world.storage.RegionFile; - -import java.io.File; - -public interface RamDiskManager { - void createRamDisk(int size, String mountPath); - void removeRamDisk(); - void uploadFile(RegionFile file); - void removeFile(RegionFile file); - int getRamDiskSize(); - RegionFile[] getRamDiskFiles(); - void adjustRamDiskSize(int newSize); -} diff --git a/src/main/java/com/github/tatercertified/potatoptimize/utils/random/SplittableRandomImpl.java b/src/main/java/com/github/tatercertified/potatoptimize/utils/random/SplittableRandomImpl.java deleted file mode 100644 index 712064a..0000000 --- a/src/main/java/com/github/tatercertified/potatoptimize/utils/random/SplittableRandomImpl.java +++ /dev/null @@ -1,151 +0,0 @@ -package com.github.tatercertified.potatoptimize.utils.random; - -import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.random.Random; -import net.minecraft.util.math.random.RandomSplitter; - -import java.util.SplittableRandom; -import java.util.UUID; - -public class SplittableRandomImpl implements PotatoptimizedRandom { - private SplittableRandom random = new SplittableRandom();; - private long seed; - - public SplittableRandomImpl() { - } - - public SplittableRandomImpl(long seed) { - setSeed(seed); - } - - @Override - public double nextDouble(double bound) { - return this.random.nextDouble(bound); - } - - @Override - public double nextDouble(double origin, double bound) { - return this.random.nextDouble(origin, bound); - } - - @Override - public float nextFloat(float bound) { - return this.random.nextFloat(bound); - } - - @Override - public float nextFloat(float origin, float bound) { - return this.random.nextFloat(origin, bound); - } - - @Override - public float nextGaussian(float mean, float deviation) { - return (float) (mean + quickGaussian() * deviation); - } - - // Gaussian Code - private double quickGaussian() { - long randomBits = nextLong(); - long evenChunks = randomBits & EVEN_CHUNKS; - long oddChunks = (randomBits & ODD_CHUNKS) >>> 5; - long sum = chunkSum(evenChunks + oddChunks) - 186; - return sum / 31.0; - } - - private long chunkSum(long bits) { - long sum = bits + (bits >>> 40); - sum += sum >>> 20; - sum += sum >>> 10; - sum &= (1<<10)-1; - return sum; - } - - private final long EVEN_CHUNKS = 0x7c1f07c1f07c1fL; - private final long ODD_CHUNKS = EVEN_CHUNKS << 5; - - @Override - public UUID nextUUID() { - return new UUID( nextLong() & 0xFFFFFFFFFFFF0FFFL | 0x4000L, nextLong() & 0x3FFFFFFFFFFFFFFFL | Long.MIN_VALUE); - } - - @Override - public Random split() { - return new SplittableRandomImpl(nextLong()); - } - - @Override - public RandomSplitter nextSplitter() { - return new Splitter(this.seed, this); - } - - @Override - public void setSeed(long seed) { - this.seed = seed; - this.random = new SplittableRandom(this.seed); - } - - @Override - public int nextInt() { - return this.random.nextInt(); - } - - @Override - public int nextInt(int bound) { - return this.random.nextInt(bound); - } - - @Override - public int nextBetween(int min, int max) { - return this.random.nextInt(min, max); - } - - @Override - public long nextLong() { - return this.random.nextLong(); - } - - @Override - public boolean nextBoolean() { - return this.random.nextBoolean(); - } - - @Override - public float nextFloat() { - return this.random.nextFloat(); - } - - @Override - public double nextDouble() { - return this.random.nextDouble(); - } - - @Override - public double nextGaussian() { - return quickGaussian(); - } - - private record Splitter(long seed, SplittableRandomImpl instance) implements RandomSplitter { - @Override - public Random split(String seed) { - int i = seed.hashCode(); - return new SplittableRandomImpl((long)i ^ this.seed); - } - - @Override - public Random split(long seed) { - return new SplittableRandomImpl(seed ^ this.seed); - } - - @Override - public Random split(int x, int y, int z) { - long l = MathHelper.hashCode(x, y, z); - long m = l ^ this.seed; - return new SplittableRandomImpl(m); - } - - @Override - public void addDebugInfo(StringBuilder info) { - info.append("seed: ").append(this.seed); - } - } -} diff --git a/src/main/resources/assets/potatoptimize/icon.png b/src/main/resources/assets/potatoptimize/icon.png new file mode 100644 index 0000000000000000000000000000000000000000..c18696fd004eccb357af3b9c95892c225e50818f GIT binary patch literal 3617 zcmV++4&L#JP)E$1*m=1O&E#7!imeLM*BZuEKx;L5#r|3?wmoz-B3fA(RWd%<_bA!lsy2fCOlJ z%e{AIPIvw|bDth4SaXG_R~6K+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