mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-01 02:46:41 +00:00
Fixed a bunch of extends and removed slottableblockbag
This commit is contained in:
@ -1,10 +1,6 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.FaweCache;
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap;
|
||||
import java.io.FileNotFoundException;
|
||||
|
||||
|
@ -1,10 +1,7 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
|
||||
import com.sk89q.worldedit.world.block.BlockState;
|
||||
import com.sk89q.worldedit.world.block.BlockType;
|
||||
import com.sk89q.worldedit.world.block.BlockTypes;
|
||||
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.io.File;
|
||||
import java.io.FileNotFoundException;
|
||||
@ -123,10 +120,6 @@ public class DelegateTextureUtil extends TextureUtil {
|
||||
return parent.colorDistance(red1, green1, blue1, c2);
|
||||
}
|
||||
|
||||
public static int hueDistance(int red1, int green1, int blue1, int red2, int green2, int blue2) {
|
||||
return TextureUtil.hueDistance(red1, green1, blue1, red2, green2, blue2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getDistance(BufferedImage image, int c1) {
|
||||
return parent.getDistance(image, c1);
|
||||
|
@ -41,8 +41,7 @@ public class FaweTimer implements Runnable {
|
||||
if (tick < lastGetTPSTick + tickInterval) {
|
||||
return lastGetTPSValue;
|
||||
}
|
||||
double total = 0;
|
||||
for (double v : history) total += v;
|
||||
double total = Arrays.stream(history).sum();
|
||||
lastGetTPSValue = total / history.length;
|
||||
lastGetTPSTick = tick;
|
||||
return lastGetTPSValue;
|
||||
|
@ -1,8 +1,5 @@
|
||||
package com.boydti.fawe.util;
|
||||
|
||||
import com.boydti.fawe.object.io.FastByteArrayOutputStream;
|
||||
import com.google.gson.Gson;
|
||||
import com.google.gson.JsonObject;
|
||||
import java.io.*;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
@ -13,30 +10,6 @@ import java.util.stream.Collectors;
|
||||
public class ImgurUtility {
|
||||
public static final String CLIENT_ID = "50e34b65351eb07";
|
||||
|
||||
public static URL uploadImage(File file) throws IOException {
|
||||
return uploadImage(new FileInputStream(file));
|
||||
}
|
||||
|
||||
public static URL uploadImage(InputStream inputStream) throws IOException {
|
||||
inputStream = new BufferedInputStream(inputStream);
|
||||
FastByteArrayOutputStream baos = new FastByteArrayOutputStream(Short.MAX_VALUE);
|
||||
int i;
|
||||
while ((i = inputStream.read()) != -1) {
|
||||
baos.write(i);
|
||||
}
|
||||
baos.flush();
|
||||
return uploadImage(baos.toByteArray());
|
||||
}
|
||||
|
||||
public static URL uploadImage(byte[] image) throws IOException {
|
||||
String json = getImgurContent(CLIENT_ID, image);
|
||||
Gson gson = new Gson();
|
||||
JsonObject obj = gson.fromJson(json, JsonObject.class);
|
||||
JsonObject data = obj.get("data").getAsJsonObject();
|
||||
String link = data.get("link").getAsString();
|
||||
return new URL(link);
|
||||
}
|
||||
|
||||
public static String getImgurContent(String clientID, byte[] image) throws IOException {
|
||||
String imageString = Base64.getEncoder().encodeToString(image);
|
||||
URL url = new URL("https://api.imgur.com/3/image");
|
||||
|
@ -69,10 +69,10 @@ public class TextureUtil implements TextureHolder {
|
||||
private BiomeColor[] biomes = new BiomeColor[]{
|
||||
// ID Name Temperature, rainfall, grass, foliage colors
|
||||
// - note: the colors here are just placeholders, they are computed in the program
|
||||
new BiomeColor(0, "ocean", 0.5f, 0.5f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(0, "ocean", 0.5f, 0.5f, 0x92BD59, 7842607),
|
||||
// default values of temp and rain
|
||||
new BiomeColor(1, "plains", 0.8f, 0.4f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(2, "desert", 2.0f, 0.0f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(1, "plains", 0.8f, 0.4f, 0x92BD59, 7842607),
|
||||
new BiomeColor(2, "desert", 2.0f, 0.0f, 0x92BD59, 7842607),
|
||||
new BiomeColor(3, "mountains", 0.2f, 0.3f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(4, "forest", 0.7f, 0.8f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(5, "taiga", 0.25f, 0.8f, 0x92BD59, 0x77AB2F),
|
||||
@ -97,7 +97,7 @@ public class TextureUtil implements TextureHolder {
|
||||
new BiomeColor(22, "jungle_hills", 0.95f, 0.9f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(23, "jungle_edge", 0.95f, 0.8f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(24, "deep_ocean", 0.5f, 0.5f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(25, "stone_shore", 0.2f, 0.3f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(25, "stone_shore", 0.2f, 0.3f, 9616729, 0x77AB2F),
|
||||
new BiomeColor(26, "snowy_beach", 0.05f, 0.3f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(27, "birch_forest", 0.6f, 0.6f, 0x92BD59, 0x77AB2F),
|
||||
new BiomeColor(28, "birch_forest_hills", 0.6f, 0.6f, 0x92BD59, 0x77AB2F),
|
||||
|
@ -15,7 +15,6 @@ import com.sk89q.worldedit.regions.Region;
|
||||
import com.sk89q.worldedit.util.Location;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.ArrayDeque;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
@ -44,26 +43,6 @@ public class WEManager {
|
||||
cancelEditSafe(parent, reason);
|
||||
}
|
||||
|
||||
public boolean maskContains(HashSet<RegionWrapper> mask, int x, int z) {
|
||||
for (RegionWrapper region : mask) {
|
||||
if (x >= region.minX && x <= region.maxX && z >= region.minZ && z <= region.maxZ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean maskContains(RegionWrapper[] mask, int x, int z) {
|
||||
switch (mask.length) {
|
||||
case 0:
|
||||
return false;
|
||||
case 1:
|
||||
return mask[0].isIn(x, z);
|
||||
default:
|
||||
return Arrays.stream(mask).anyMatch(region -> region.isIn(x, z));
|
||||
}
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public Region[] getMask(Player player) {
|
||||
return getMask(player, FaweMaskManager.MaskType.getDefaultMaskType());
|
||||
|
@ -3,5 +3,5 @@ package com.boydti.fawe.util.image;
|
||||
import java.awt.image.BufferedImage;
|
||||
|
||||
public interface Drawable {
|
||||
public BufferedImage draw();
|
||||
BufferedImage draw();
|
||||
}
|
||||
|
@ -3,5 +3,5 @@ package com.boydti.fawe.util.image;
|
||||
import java.io.Closeable;
|
||||
|
||||
public interface ImageViewer extends Closeable{
|
||||
public void view(Drawable drawable);
|
||||
void view(Drawable drawable);
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
package com.boydti.fawe.util.terrain;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
|
||||
import static com.boydti.fawe.util.MathMan.pairInt;
|
||||
|
||||
public final class Erosion {
|
||||
private final int area;
|
||||
private float[][] terrainHeight;
|
||||
private float[][] waterHeight;
|
||||
|
||||
private long[] queue_2;
|
||||
private long[] queue;
|
||||
private int queueIndex;
|
||||
|
||||
public Erosion(int width, int length) {
|
||||
this.area = width * length;
|
||||
queue = new long[area];
|
||||
Arrays.fill(queue, -1);
|
||||
|
||||
}
|
||||
|
||||
public void addWater(int x, int z, float amt) {
|
||||
waterHeight[x][z] += amt;
|
||||
queue[queueIndex++] = pairInt(x, z);
|
||||
}
|
||||
|
||||
public void propogateWater() {
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
Reference in New Issue
Block a user