Buckets & entity enhancements, cleanup

This commit is contained in:
paulevsGitch 2021-04-19 21:22:11 +03:00
parent 00fd2b6199
commit 3ec2edd6d5
234 changed files with 1988 additions and 1643 deletions

View file

@ -5,6 +5,10 @@ import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
@ -19,8 +23,6 @@ import net.minecraft.world.level.block.Rotation;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty;
import net.minecraft.world.level.block.state.properties.Property;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import ru.betterend.blocks.BlueVineBlock;
import ru.betterend.blocks.basis.DoublePlantBlock;
import ru.betterend.blocks.basis.FurBlock;

View file

@ -3,10 +3,12 @@ package ru.betterend.util;
import java.util.List;
import java.util.Map;
import java.util.Random;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.level.block.Block;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndBlocks;
import ru.betterend.world.biome.EndBiome;

View file

@ -1,240 +1,241 @@
package ru.betterend.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Maps;
import com.mojang.blaze3d.platform.NativeImage;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.ColorHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.util.Mth;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import ru.betterend.BetterEnd;
@Environment(EnvType.CLIENT)
public class ColorUtil {
private static float[] floatBuffer = new float[4];
public static int[] toIntArray(int color) {
return new int[] {
(color >> 24) & 255,
(color >> 16) & 255,
(color >> 8) & 255,
color & 255
};
}
public static float[] toFloatArray(int color) {
floatBuffer[0] = ((color >> 16 & 255) / 255.0F);
floatBuffer[1] = ((color >> 8 & 255) / 255.0F);
floatBuffer[2] = ((color & 255) / 255.0F);
floatBuffer[3] = ((color >> 24 & 255) / 255.0F);
return floatBuffer;
}
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals) {
float hue, saturation, brightness;
if (hsbvals == null) {
hsbvals = floatBuffer;
}
int cmax = (r > g) ? r : g;
if (b > cmax) cmax = b;
int cmin = (r < g) ? r : g;
if (b < cmin) cmin = b;
brightness = ((float) cmax) / 255.0F;
if (cmax != 0)
saturation = ((float) (cmax - cmin)) / ((float) cmax);
else
saturation = 0;
if (saturation == 0)
hue = 0;
else {
float redc = ((float) (cmax - r)) / ((float) (cmax - cmin));
float greenc = ((float) (cmax - g)) / ((float) (cmax - cmin));
float bluec = ((float) (cmax - b)) / ((float) (cmax - cmin));
if (r == cmax)
hue = bluec - greenc;
else if (g == cmax)
hue = 2.0F + redc - bluec;
else
hue = 4.0F + greenc - redc;
hue = hue / 6.0F;
if (hue < 0)
hue = hue + 1.0F;
}
hsbvals[0] = hue;
hsbvals[1] = saturation;
hsbvals[2] = brightness;
return hsbvals;
}
public static int HSBtoRGB(float hue, float saturation, float brightness) {
int r = 0, g = 0, b = 0;
if (saturation == 0) {
r = g = b = (int) (brightness * 255.0F + 0.5F);
} else {
float h = (hue - (float)Math.floor(hue)) * 6.0F;
float f = h - (float)java.lang.Math.floor(h);
float p = brightness * (1.0F - saturation);
float q = brightness * (1.0F - saturation * f);
float t = brightness * (1.0F - (saturation * (1.0F - f)));
switch ((int) h) {
case 0:
r = (int) (brightness * 255.0F + 0.5F);
g = (int) (t * 255.0F + 0.5F);
b = (int) (p * 255.0F + 0.5F);
break;
case 1:
r = (int) (q * 255.0F + 0.5F);
g = (int) (brightness * 255.0F + 0.5F);
b = (int) (p * 255.0F + 0.5F);
break;
case 2:
r = (int) (p * 255.0F + 0.5F);
g = (int) (brightness * 255.0F + 0.5F);
b = (int) (t * 255.0F + 0.5F);
break;
case 3:
r = (int) (p * 255.0F + 0.5F);
g = (int) (q * 255.0F + 0.5F);
b = (int) (brightness * 255.0F + 0.5F);
break;
case 4:
r = (int) (t * 255.0F + 0.5F);
g = (int) (p * 255.0F + 0.5F);
b = (int) (brightness * 255.0F + 0.5F);
break;
case 5:
r = (int) (brightness * 255.0F + 0.5F);
g = (int) (p * 255.0F + 0.5F);
b = (int) (q * 255.0F + 0.5F);
break;
}
}
return 0xFF000000 | (r << 16) | (g << 8) | (b << 0);
}
public static int parseHex(String hexColor) {
int len = hexColor.length();
if (len < 6 || len > 8 || len % 2 > 0) {
return -1;
}
int color, shift;
if(len == 6) {
color = 0xFF000000; shift = 16;
} else {
color = 0; shift = 24;
}
try {
String[] splited = hexColor.split("(?<=\\G.{2})");
for (String digit : splited) {
color |= Integer.valueOf(digit, 16) << shift;
shift -= 8;
}
} catch(NumberFormatException ex) {
BetterEnd.LOGGER.catching(ex);
return -1;
}
return color;
}
public static int toABGR(int color) {
int r = (color >> 16) & 255;
int g = (color >> 8) & 255;
int b = color & 255;
return 0xFF000000 | b << 16 | g << 8 | r;
}
public static int ABGRtoARGB(int color) {
int a = (color >> 24) & 255;
int b = (color >> 16) & 255;
int g = (color >> 8) & 255;
int r = color & 255;
return a << 24 | r << 16 | g << 8 | b;
}
public static int colorBrigtness(int color, float val) {
RGBtoHSB((color >> 16) & 255, (color >> 8) & 255, color & 255, floatBuffer);
floatBuffer[2] += val / 10.0F;
floatBuffer[2] = Mth.clamp(floatBuffer[2], 0.0F, 1.0F);
return HSBtoRGB(floatBuffer[0], floatBuffer[1], floatBuffer[2]);
}
public static int applyTint(int color, int tint) {
return colorBrigtness(ColorHelper.multiplyColor(color, tint), 1.5F);
}
public static int colorDistance(int color1, int color2) {
int r1 = (color1 >> 16) & 255;
int g1 = (color1 >> 8) & 255;
int b1 = color1 & 255;
int r2 = (color2 >> 16) & 255;
int g2 = (color2 >> 8) & 255;
int b2 = color2 & 255;
return MHelper.pow2(r1 - r2) + MHelper.pow2(g1 - g2) + MHelper.pow2(b1 - b2);
}
private static Map<ResourceLocation, Integer> colorPalette = Maps.newHashMap();
public static int extractColor(Item item) {
ResourceLocation id = Registry.ITEM.getKey(item);
if (id.equals(Registry.ITEM.getDefaultKey())) return -1;
if (colorPalette.containsKey(id)) {
return colorPalette.get(id);
}
ResourceLocation texture;
if (item instanceof BlockItem) {
texture = new ResourceLocation(id.getNamespace(), "textures/block/" + id.getPath() + ".png");
} else {
texture = new ResourceLocation(id.getNamespace(), "textures/item/" + id.getPath() + ".png");
}
NativeImage image = loadImage(texture, 16, 16);
List<Integer> colors = new ArrayList<>();
for (int i = 0; i < image.getWidth(); i++) {
for (int j = 0; j < 16; j++) {
int col = image.getPixelRGBA(i, j);
if (((col >> 24) & 255) > 0) {
colors.add(ABGRtoARGB(col));
}
}
}
image.close();
if (colors.size() == 0) return -1;
ColorExtractor extractor = new ColorExtractor(colors);
int color = extractor.analize();
colorPalette.put(id, color);
return color;
}
public static NativeImage loadImage(ResourceLocation image, int w, int h) {
Minecraft minecraft = Minecraft.getInstance();
ResourceManager resourceManager = minecraft.getResourceManager();
if (resourceManager.hasResource(image)) {
try (Resource resource = resourceManager.getResource(image)) {
return NativeImage.read(resource.getInputStream());
} catch (IOException e) {
BetterEnd.LOGGER.warning("Can't load texture image: {}. Will be created empty image.", image);
BetterEnd.LOGGER.warning("Cause: {}.", e.getMessage());
}
}
return new NativeImage(w, h, false);
}
package ru.betterend.util;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.google.common.collect.Maps;
import com.mojang.blaze3d.platform.NativeImage;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.impl.client.indigo.renderer.helper.ColorHelper;
import net.minecraft.client.Minecraft;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.packs.resources.Resource;
import net.minecraft.server.packs.resources.ResourceManager;
import net.minecraft.util.Mth;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.Item;
import ru.betterend.BetterEnd;
@Environment(EnvType.CLIENT)
public class ColorUtil {
private static float[] floatBuffer = new float[4];
public static int[] toIntArray(int color) {
return new int[] {
(color >> 24) & 255,
(color >> 16) & 255,
(color >> 8) & 255,
color & 255
};
}
public static float[] toFloatArray(int color) {
floatBuffer[0] = ((color >> 16 & 255) / 255.0F);
floatBuffer[1] = ((color >> 8 & 255) / 255.0F);
floatBuffer[2] = ((color & 255) / 255.0F);
floatBuffer[3] = ((color >> 24 & 255) / 255.0F);
return floatBuffer;
}
public static float[] RGBtoHSB(int r, int g, int b, float[] hsbvals) {
float hue, saturation, brightness;
if (hsbvals == null) {
hsbvals = floatBuffer;
}
int cmax = (r > g) ? r : g;
if (b > cmax) cmax = b;
int cmin = (r < g) ? r : g;
if (b < cmin) cmin = b;
brightness = ((float) cmax) / 255.0F;
if (cmax != 0)
saturation = ((float) (cmax - cmin)) / ((float) cmax);
else
saturation = 0;
if (saturation == 0)
hue = 0;
else {
float redc = ((float) (cmax - r)) / ((float) (cmax - cmin));
float greenc = ((float) (cmax - g)) / ((float) (cmax - cmin));
float bluec = ((float) (cmax - b)) / ((float) (cmax - cmin));
if (r == cmax)
hue = bluec - greenc;
else if (g == cmax)
hue = 2.0F + redc - bluec;
else
hue = 4.0F + greenc - redc;
hue = hue / 6.0F;
if (hue < 0)
hue = hue + 1.0F;
}
hsbvals[0] = hue;
hsbvals[1] = saturation;
hsbvals[2] = brightness;
return hsbvals;
}
public static int HSBtoRGB(float hue, float saturation, float brightness) {
int r = 0, g = 0, b = 0;
if (saturation == 0) {
r = g = b = (int) (brightness * 255.0F + 0.5F);
} else {
float h = (hue - (float)Math.floor(hue)) * 6.0F;
float f = h - (float)java.lang.Math.floor(h);
float p = brightness * (1.0F - saturation);
float q = brightness * (1.0F - saturation * f);
float t = brightness * (1.0F - (saturation * (1.0F - f)));
switch ((int) h) {
case 0:
r = (int) (brightness * 255.0F + 0.5F);
g = (int) (t * 255.0F + 0.5F);
b = (int) (p * 255.0F + 0.5F);
break;
case 1:
r = (int) (q * 255.0F + 0.5F);
g = (int) (brightness * 255.0F + 0.5F);
b = (int) (p * 255.0F + 0.5F);
break;
case 2:
r = (int) (p * 255.0F + 0.5F);
g = (int) (brightness * 255.0F + 0.5F);
b = (int) (t * 255.0F + 0.5F);
break;
case 3:
r = (int) (p * 255.0F + 0.5F);
g = (int) (q * 255.0F + 0.5F);
b = (int) (brightness * 255.0F + 0.5F);
break;
case 4:
r = (int) (t * 255.0F + 0.5F);
g = (int) (p * 255.0F + 0.5F);
b = (int) (brightness * 255.0F + 0.5F);
break;
case 5:
r = (int) (brightness * 255.0F + 0.5F);
g = (int) (p * 255.0F + 0.5F);
b = (int) (q * 255.0F + 0.5F);
break;
}
}
return 0xFF000000 | (r << 16) | (g << 8) | (b << 0);
}
public static int parseHex(String hexColor) {
int len = hexColor.length();
if (len < 6 || len > 8 || len % 2 > 0) {
return -1;
}
int color, shift;
if(len == 6) {
color = 0xFF000000; shift = 16;
} else {
color = 0; shift = 24;
}
try {
String[] splited = hexColor.split("(?<=\\G.{2})");
for (String digit : splited) {
color |= Integer.valueOf(digit, 16) << shift;
shift -= 8;
}
} catch(NumberFormatException ex) {
BetterEnd.LOGGER.catching(ex);
return -1;
}
return color;
}
public static int toABGR(int color) {
int r = (color >> 16) & 255;
int g = (color >> 8) & 255;
int b = color & 255;
return 0xFF000000 | b << 16 | g << 8 | r;
}
public static int ABGRtoARGB(int color) {
int a = (color >> 24) & 255;
int b = (color >> 16) & 255;
int g = (color >> 8) & 255;
int r = color & 255;
return a << 24 | r << 16 | g << 8 | b;
}
public static int colorBrigtness(int color, float val) {
RGBtoHSB((color >> 16) & 255, (color >> 8) & 255, color & 255, floatBuffer);
floatBuffer[2] += val / 10.0F;
floatBuffer[2] = Mth.clamp(floatBuffer[2], 0.0F, 1.0F);
return HSBtoRGB(floatBuffer[0], floatBuffer[1], floatBuffer[2]);
}
public static int applyTint(int color, int tint) {
return colorBrigtness(ColorHelper.multiplyColor(color, tint), 1.5F);
}
public static int colorDistance(int color1, int color2) {
int r1 = (color1 >> 16) & 255;
int g1 = (color1 >> 8) & 255;
int b1 = color1 & 255;
int r2 = (color2 >> 16) & 255;
int g2 = (color2 >> 8) & 255;
int b2 = color2 & 255;
return MHelper.pow2(r1 - r2) + MHelper.pow2(g1 - g2) + MHelper.pow2(b1 - b2);
}
private static Map<ResourceLocation, Integer> colorPalette = Maps.newHashMap();
public static int extractColor(Item item) {
ResourceLocation id = Registry.ITEM.getKey(item);
if (id.equals(Registry.ITEM.getDefaultKey())) return -1;
if (colorPalette.containsKey(id)) {
return colorPalette.get(id);
}
ResourceLocation texture;
if (item instanceof BlockItem) {
texture = new ResourceLocation(id.getNamespace(), "textures/block/" + id.getPath() + ".png");
} else {
texture = new ResourceLocation(id.getNamespace(), "textures/item/" + id.getPath() + ".png");
}
NativeImage image = loadImage(texture, 16, 16);
List<Integer> colors = new ArrayList<>();
for (int i = 0; i < image.getWidth(); i++) {
for (int j = 0; j < 16; j++) {
int col = image.getPixelRGBA(i, j);
if (((col >> 24) & 255) > 0) {
colors.add(ABGRtoARGB(col));
}
}
}
image.close();
if (colors.size() == 0) return -1;
ColorExtractor extractor = new ColorExtractor(colors);
int color = extractor.analize();
colorPalette.put(id, color);
return color;
}
public static NativeImage loadImage(ResourceLocation image, int w, int h) {
Minecraft minecraft = Minecraft.getInstance();
ResourceManager resourceManager = minecraft.getResourceManager();
if (resourceManager.hasResource(image)) {
try (Resource resource = resourceManager.getResource(image)) {
return NativeImage.read(resource.getInputStream());
} catch (IOException e) {
BetterEnd.LOGGER.warning("Can't load texture image: {}. Will be created empty image.", image);
BetterEnd.LOGGER.warning("Cause: {}.", e.getMessage());
}
}
return new NativeImage(w, h, false);
}
}

View file

@ -4,12 +4,14 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import java.util.function.Supplier;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import net.minecraft.core.Registry;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import ru.betterend.mixin.common.BiomeGenerationSettingsAccessor;
import ru.betterend.registry.EndFeatures;
import ru.betterend.registry.EndStructures;

View file

@ -1,72 +1,73 @@
package ru.betterend.util;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.google.gson.JsonObject;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import ru.betterend.BetterEnd;
public class ItemUtil {
public static String toStackString(@NotNull ItemStack stack) {
try {
if (stack == null) {
throw new IllegalStateException("Stack can't be null!");
}
Item item = stack.getItem();
return Registry.ITEM.getKey(item) + ":" + stack.getCount();
} catch (Exception ex) {
BetterEnd.LOGGER.error("ItemStack serialization error!", ex);
}
return "";
}
@Nullable
public static ItemStack fromStackString(String stackString) {
if (stackString == null || stackString.equals("")) {
return null;
}
try {
String[] parts = stackString.split(":");
if (parts.length < 2) return null;
if (parts.length == 2) {
ResourceLocation itemId = new ResourceLocation(stackString);
Item item = Registry.ITEM.getOptional(itemId).orElseThrow(() -> {
return new IllegalStateException("Output item " + itemId + " does not exists!");
});
return new ItemStack(item);
}
ResourceLocation itemId = new ResourceLocation(parts[0], parts[1]);
Item item = Registry.ITEM.getOptional(itemId).orElseThrow(() -> {
return new IllegalStateException("Output item " + itemId + " does not exists!");
});
return new ItemStack(item, Integer.valueOf(parts[2]));
} catch (Exception ex) {
BetterEnd.LOGGER.error("ItemStack deserialization error!", ex);
}
return null;
}
@Nullable
public static ItemStack fromJsonRecipe(JsonObject recipe) {
try {
if (!recipe.has("item")) {
throw new IllegalStateException("Invalid JsonObject. Entry 'item' does not exists!");
}
ResourceLocation itemId = new ResourceLocation(GsonHelper.getAsString(recipe, "item"));
Item item = Registry.ITEM.getOptional(itemId).orElseThrow(() -> {
return new IllegalStateException("Output item " + itemId + " does not exists!");
});
int count = GsonHelper.getAsInt(recipe, "count", 1);
return new ItemStack(item, count);
} catch (Exception ex) {
BetterEnd.LOGGER.error("ItemStack deserialization error!", ex);
}
return null;
}
}
package ru.betterend.util;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import com.google.gson.JsonObject;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.util.GsonHelper;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import ru.betterend.BetterEnd;
public class ItemUtil {
public static String toStackString(@NotNull ItemStack stack) {
try {
if (stack == null) {
throw new IllegalStateException("Stack can't be null!");
}
Item item = stack.getItem();
return Registry.ITEM.getKey(item) + ":" + stack.getCount();
} catch (Exception ex) {
BetterEnd.LOGGER.error("ItemStack serialization error!", ex);
}
return "";
}
@Nullable
public static ItemStack fromStackString(String stackString) {
if (stackString == null || stackString.equals("")) {
return null;
}
try {
String[] parts = stackString.split(":");
if (parts.length < 2) return null;
if (parts.length == 2) {
ResourceLocation itemId = new ResourceLocation(stackString);
Item item = Registry.ITEM.getOptional(itemId).orElseThrow(() -> {
return new IllegalStateException("Output item " + itemId + " does not exists!");
});
return new ItemStack(item);
}
ResourceLocation itemId = new ResourceLocation(parts[0], parts[1]);
Item item = Registry.ITEM.getOptional(itemId).orElseThrow(() -> {
return new IllegalStateException("Output item " + itemId + " does not exists!");
});
return new ItemStack(item, Integer.valueOf(parts[2]));
} catch (Exception ex) {
BetterEnd.LOGGER.error("ItemStack deserialization error!", ex);
}
return null;
}
@Nullable
public static ItemStack fromJsonRecipe(JsonObject recipe) {
try {
if (!recipe.has("item")) {
throw new IllegalStateException("Invalid JsonObject. Entry 'item' does not exists!");
}
ResourceLocation itemId = new ResourceLocation(GsonHelper.getAsString(recipe, "item"));
Item item = Registry.ITEM.getOptional(itemId).orElseThrow(() -> {
return new IllegalStateException("Output item " + itemId + " does not exists!");
});
int count = GsonHelper.getAsInt(recipe, "count", 1);
return new ItemStack(item, count);
} catch (Exception ex) {
BetterEnd.LOGGER.error("ItemStack deserialization error!", ex);
}
return null;
}
}

View file

@ -1,7 +1,9 @@
package ru.betterend.util;
import com.mojang.math.Vector3f;
import java.util.Random;
import com.mojang.math.Vector3f;
import net.minecraft.world.phys.Vec3;
public class MHelper {

View file

@ -4,13 +4,15 @@ import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.function.Function;
import com.google.common.collect.Lists;
import com.mojang.math.Vector3f;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.util.Mth;
import net.minecraft.world.level.WorldGenLevel;
import net.minecraft.world.level.block.state.BlockState;
import com.google.common.collect.Lists;
import com.mojang.math.Vector3f;
import ru.betterend.util.sdf.SDF;
import ru.betterend.util.sdf.operator.SDFUnion;
import ru.betterend.util.sdf.primitive.SDFLine;

View file

@ -10,6 +10,7 @@ import java.util.zip.ZipEntry;
import java.util.zip.ZipFile;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;

View file

@ -2,14 +2,16 @@ package ru.betterend.util;
import java.util.Map;
import java.util.Set;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.tags.Tag;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.ItemLike;
import net.minecraft.world.level.block.Block;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
public class TagHelper {
private static final Map<ResourceLocation, Set<ResourceLocation>> TAGS_BLOCK = Maps.newConcurrentMap();

View file

@ -4,11 +4,13 @@ import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.Collections;
import java.util.List;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import com.google.common.collect.Lists;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
import net.minecraft.core.Registry;
import net.minecraft.resources.ResourceLocation;
import ru.betterend.BetterEnd;
import ru.betterend.registry.EndBiomes;
import ru.betterend.registry.EndItems;

View file

@ -1,6 +1,7 @@
package ru.betterend.util.sdf;
import java.util.Map;
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.block.Blocks;

View file

@ -6,15 +6,17 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.function.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import net.minecraft.core.BlockPos;
import net.minecraft.core.BlockPos.MutableBlockPos;
import net.minecraft.core.Direction;
import net.minecraft.world.level.ServerLevelAccessor;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.AABB;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.google.common.collect.Sets;
import ru.betterend.util.BlocksHelper;
import ru.betterend.world.structures.StructureWorld;

View file

@ -1,8 +1,9 @@
package ru.betterend.util.sdf.operator;
import com.mojang.math.Vector3f;
import java.util.function.Consumer;
import com.mojang.math.Vector3f;
public class SDFCoordModify extends SDFUnary {
private static final Vector3f POS = new Vector3f();
private Consumer<Vector3f> function;

View file

@ -1,8 +1,9 @@
package ru.betterend.util.sdf.operator;
import com.mojang.math.Vector3f;
import java.util.function.Function;
import com.mojang.math.Vector3f;
public class SDFDisplacement extends SDFUnary {
private static final Vector3f POS = new Vector3f();
private Function<Vector3f, Float> displace;

View file

@ -1,6 +1,7 @@
package ru.betterend.util.sdf.operator;
import com.mojang.blaze3d.platform.NativeImage;
import net.minecraft.util.Mth;
public class SDFHeightmap extends SDFDisplacement {

View file

@ -1,6 +1,7 @@
package ru.betterend.util.sdf.primitive;
import java.util.function.Function;
import net.minecraft.core.BlockPos;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.state.BlockState;