Flamboyant Refabricated Integration (WIP)

This commit is contained in:
paulevsGitch 2021-03-24 22:25:34 +03:00
parent a2ca5fe3df
commit b933b0e522
9 changed files with 128 additions and 17 deletions

View file

@ -2,9 +2,11 @@ package ru.betterend.util;
import java.util.HashSet;
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.block.Block;
@ -31,6 +33,7 @@ import ru.betterend.registry.EndTags;
public class BlocksHelper {
public static final BooleanProperty ROOTS = BooleanProperty.of("roots");
private static final Map<Block, Integer> COLOR_BY_BLOCK = Maps.newHashMap();
public static final int FLAG_UPDATE_BLOCK = 1;
public static final int FLAG_SEND_CLIENT_CHANGES = 2;
@ -60,6 +63,14 @@ public class BlocksHelper {
new Vec3i(1, 0, -1), new Vec3i(1, 0, 0), new Vec3i(1, 0, 1),
new Vec3i(1, 1, -1), new Vec3i(1, 1, 0), new Vec3i(1, 1, 1)
};
public static void addBlockColor(Block block, int color) {
COLOR_BY_BLOCK.put(block, color);
}
public static int getBlockColor(Block block) {
return COLOR_BY_BLOCK.getOrDefault(block, 0xFF000000);
}
public static void setWithoutUpdate(WorldAccess world, BlockPos pos, BlockState state) {
world.setBlockState(pos, state, SET_SILENT);

View file

@ -15,6 +15,13 @@ public class MHelper {
public static int color(int r, int g, int b) {
return ALPHA | (r << 16) | (g << 8) | b;
}
public static int color(String hex) {
int r = Integer.parseInt(hex.substring(0, 2), 16);
int g = Integer.parseInt(hex.substring(2, 4), 16);
int b = Integer.parseInt(hex.substring(4, 6), 16);
return color(r, g, b);
}
public static int randRange(int min, int max, Random random) {
return min + random.nextInt(max - min + 1);