Code style changes, entities fixes
This commit is contained in:
parent
9d604b2d25
commit
44962e18b6
377 changed files with 5038 additions and 4914 deletions
|
@ -1,7 +1,5 @@
|
|||
package ru.betterend.blocks;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.minecraft.client.color.block.BlockColor;
|
||||
|
@ -18,9 +16,11 @@ import ru.bclib.util.ColorUtil;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.betterend.registry.EndParticles;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider {
|
||||
public static final Vec3i[] COLORS;
|
||||
|
||||
|
||||
public TenaneaFlowersBlock() {
|
||||
super(15);
|
||||
}
|
||||
|
@ -30,22 +30,23 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
|
|||
return (state, world, pos, tintIndex) -> {
|
||||
if (pos == null) {
|
||||
pos = BlockPos.ZERO;
|
||||
};
|
||||
}
|
||||
;
|
||||
long i = (MHelper.getRandom(pos.getX(), pos.getZ()) & 63) + pos.getY();
|
||||
double delta = i * 0.1;
|
||||
int index = MHelper.floor(delta);
|
||||
int index2 = (index + 1) & 3;
|
||||
delta -= index;
|
||||
index &= 3;
|
||||
|
||||
|
||||
Vec3i color1 = COLORS[index];
|
||||
Vec3i color2 = COLORS[index2];
|
||||
|
||||
|
||||
int r = MHelper.floor(Mth.lerp(delta, color1.getX(), color2.getX()));
|
||||
int g = MHelper.floor(Mth.lerp(delta, color1.getY(), color2.getY()));
|
||||
int b = MHelper.floor(Mth.lerp(delta, color1.getZ(), color2.getZ()));
|
||||
float[] hsb = ColorUtil.RGBtoHSB(r, g, b, new float[3]);
|
||||
|
||||
|
||||
return ColorUtil.HSBtoRGB(hsb[0], MHelper.max(0.5F, hsb[1]), hsb[2]);
|
||||
};
|
||||
}
|
||||
|
@ -54,12 +55,12 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
|
|||
public ItemColor getItemProvider() {
|
||||
return (stack, tintIndex) -> ColorUtil.color(255, 255, 255);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isValidBonemealTarget(BlockGetter world, BlockPos pos, BlockState state, boolean isClient) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public void animateTick(BlockState state, Level world, BlockPos pos, Random random) {
|
||||
super.animateTick(state, world, pos, random);
|
||||
|
@ -70,13 +71,13 @@ public class TenaneaFlowersBlock extends BaseVineBlock implements IColorProvider
|
|||
world.addParticle(EndParticles.TENANEA_PETAL, x, y, z, 0, 0, 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static {
|
||||
COLORS = new Vec3i[] {
|
||||
new Vec3i(250, 111, 222),
|
||||
new Vec3i(167, 89, 255),
|
||||
new Vec3i(120, 207, 239),
|
||||
new Vec3i(255, 87, 182)
|
||||
COLORS = new Vec3i[]{
|
||||
new Vec3i(250, 111, 222),
|
||||
new Vec3i(167, 89, 255),
|
||||
new Vec3i(120, 207, 239),
|
||||
new Vec3i(255, 87, 182)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue