Reorganized Imports/Packages
This commit is contained in:
parent
cb9459f176
commit
3ee10482ab
721 changed files with 34873 additions and 33558 deletions
|
@ -0,0 +1,5 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
public enum BCLRenderLayer {
|
||||
CUTOUT, TRANSLUCENT
|
||||
}
|
|
@ -0,0 +1,186 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.blockentity.BrightnessCombiner;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.*;
|
||||
import net.minecraft.world.level.block.DoubleBlockCombiner.NeighborCombineResult;
|
||||
import net.minecraft.world.level.block.entity.ChestBlockEntity;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.ChestType;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import it.unimi.dsi.fastutil.floats.Float2FloatFunction;
|
||||
import it.unimi.dsi.fastutil.ints.Int2IntFunction;
|
||||
import org.betterx.bclib.blockentities.BaseChestBlockEntity;
|
||||
import org.betterx.bclib.client.models.BaseChestBlockModel;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChestBlockEntity> {
|
||||
private static final HashMap<Block, RenderType[]> LAYERS = Maps.newHashMap();
|
||||
private static final RenderType[] RENDER_TYPES;
|
||||
|
||||
private static final int ID_NORMAL = 0;
|
||||
private static final int ID_LEFT = 1;
|
||||
private static final int ID_RIGHT = 2;
|
||||
|
||||
private final BaseChestBlockModel chestModel;
|
||||
|
||||
public BaseChestBlockEntityRenderer(BlockEntityRendererProvider.Context ctx) {
|
||||
super();
|
||||
chestModel = new BaseChestBlockModel(BaseChestBlockModel.getTexturedModelData().bakeRoot());
|
||||
}
|
||||
|
||||
public void render(BaseChestBlockEntity entity,
|
||||
float tickDelta,
|
||||
PoseStack matrices,
|
||||
MultiBufferSource vertexConsumers,
|
||||
int light,
|
||||
int overlay) {
|
||||
Level world = entity.getLevel();
|
||||
boolean worldExists = world != null;
|
||||
BlockState blockState = worldExists ? entity.getBlockState() : Blocks.CHEST.defaultBlockState()
|
||||
.setValue(
|
||||
ChestBlock.FACING,
|
||||
Direction.SOUTH
|
||||
);
|
||||
ChestType chestType = blockState.hasProperty(ChestBlock.TYPE)
|
||||
? blockState.getValue(ChestBlock.TYPE)
|
||||
: ChestType.SINGLE;
|
||||
Block block = blockState.getBlock();
|
||||
if (block instanceof AbstractChestBlock) {
|
||||
AbstractChestBlock<?> abstractChestBlock = (AbstractChestBlock<?>) block;
|
||||
boolean isDouble = chestType != ChestType.SINGLE;
|
||||
float f = blockState.getValue(ChestBlock.FACING).toYRot();
|
||||
NeighborCombineResult<? extends ChestBlockEntity> propertySource;
|
||||
|
||||
matrices.pushPose();
|
||||
matrices.translate(0.5D, 0.5D, 0.5D);
|
||||
matrices.mulPose(Vector3f.YP.rotationDegrees(-f));
|
||||
matrices.translate(-0.5D, -0.5D, -0.5D);
|
||||
|
||||
if (worldExists) {
|
||||
propertySource = abstractChestBlock.combine(blockState, world, entity.getBlockPos(), true);
|
||||
} else {
|
||||
propertySource = DoubleBlockCombiner.Combiner::acceptNone;
|
||||
}
|
||||
|
||||
float pitch = propertySource.apply(ChestBlock.opennessCombiner(entity)).get(
|
||||
tickDelta);
|
||||
pitch = 1.0F - pitch;
|
||||
pitch = 1.0F - pitch * pitch * pitch;
|
||||
@SuppressWarnings({
|
||||
"unchecked",
|
||||
"rawtypes"
|
||||
}) int blockLight = ((Int2IntFunction) propertySource.apply(new BrightnessCombiner())).applyAsInt(light);
|
||||
|
||||
VertexConsumer vertexConsumer = getConsumer(vertexConsumers, block, chestType);
|
||||
|
||||
if (isDouble) {
|
||||
if (chestType == ChestType.LEFT) {
|
||||
renderParts(
|
||||
matrices,
|
||||
vertexConsumer,
|
||||
chestModel.partLeftA,
|
||||
chestModel.partLeftB,
|
||||
chestModel.partLeftC,
|
||||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
} else {
|
||||
renderParts(
|
||||
matrices,
|
||||
vertexConsumer,
|
||||
chestModel.partRightA,
|
||||
chestModel.partRightB,
|
||||
chestModel.partRightC,
|
||||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
}
|
||||
} else {
|
||||
renderParts(
|
||||
matrices,
|
||||
vertexConsumer,
|
||||
chestModel.partA,
|
||||
chestModel.partB,
|
||||
chestModel.partC,
|
||||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
}
|
||||
|
||||
matrices.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderParts(PoseStack matrices,
|
||||
VertexConsumer vertices,
|
||||
ModelPart modelPart,
|
||||
ModelPart modelPart2,
|
||||
ModelPart modelPart3,
|
||||
float pitch,
|
||||
int light,
|
||||
int overlay) {
|
||||
modelPart.xRot = -(pitch * 1.5707964F);
|
||||
modelPart2.xRot = modelPart.xRot;
|
||||
modelPart.render(matrices, vertices, light, overlay);
|
||||
modelPart2.render(matrices, vertices, light, overlay);
|
||||
modelPart3.render(matrices, vertices, light, overlay);
|
||||
}
|
||||
|
||||
private static RenderType getChestTexture(ChestType type, RenderType[] layers) {
|
||||
return switch (type) {
|
||||
case LEFT -> layers[ID_LEFT];
|
||||
case RIGHT -> layers[ID_RIGHT];
|
||||
default -> layers[ID_NORMAL];
|
||||
};
|
||||
}
|
||||
|
||||
public static VertexConsumer getConsumer(MultiBufferSource provider, Block block, ChestType chestType) {
|
||||
RenderType[] layers = LAYERS.getOrDefault(block, RENDER_TYPES);
|
||||
return provider.getBuffer(getChestTexture(chestType, layers));
|
||||
}
|
||||
|
||||
public static void registerRenderLayer(Block block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(block);
|
||||
String modId = blockId.getNamespace();
|
||||
String path = blockId.getPath();
|
||||
LAYERS.put(
|
||||
block,
|
||||
new RenderType[]{
|
||||
RenderType.entityCutout(new ResourceLocation(modId, "textures/entity/chest/" + path + ".png")),
|
||||
RenderType.entityCutout(new ResourceLocation(modId,
|
||||
"textures/entity/chest/" + path + "_left.png")),
|
||||
RenderType.entityCutout(new ResourceLocation(modId,
|
||||
"textures/entity/chest/" + path + "_right.png"))
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
static {
|
||||
RENDER_TYPES = new RenderType[]{
|
||||
RenderType.entityCutout(new ResourceLocation("textures/entity/chest/normal.png")),
|
||||
RenderType.entityCutout(new ResourceLocation("textures/entity/chest/normal_left.png")),
|
||||
RenderType.entityCutout(new ResourceLocation("textures/entity/chest/normal_right.png"))
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.model.geom.ModelLayers;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
import net.minecraft.client.renderer.Sheets;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRenderer;
|
||||
import net.minecraft.client.renderer.blockentity.BlockEntityRendererProvider;
|
||||
import net.minecraft.client.renderer.blockentity.SignRenderer;
|
||||
import net.minecraft.client.resources.model.Material;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.SignBlock;
|
||||
import net.minecraft.world.level.block.StandingSignBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.properties.WoodType;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import org.betterx.bclib.blockentities.BaseSignBlockEntity;
|
||||
import org.betterx.bclib.blocks.BaseSignBlock;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSignBlockEntity> {
|
||||
private static final HashMap<Block, RenderType> RENDER_TYPES = Maps.newHashMap();
|
||||
private static final int OUTLINE_RENDER_DISTANCE = Mth.square(16);
|
||||
private static final RenderType RENDER_TYPE;
|
||||
private final SignRenderer.SignModel model;
|
||||
private final Font font;
|
||||
|
||||
|
||||
public BaseSignBlockEntityRenderer(BlockEntityRendererProvider.Context ctx) {
|
||||
super();
|
||||
this.font = ctx.getFont();
|
||||
model = new SignRenderer.SignModel(ctx.bakeLayer(ModelLayers.createSignModelName(WoodType.OAK)));
|
||||
}
|
||||
|
||||
public void render(BaseSignBlockEntity signBlockEntity,
|
||||
float tickDelta,
|
||||
PoseStack matrixStack,
|
||||
MultiBufferSource provider,
|
||||
int light,
|
||||
int overlay) {
|
||||
BlockState state = signBlockEntity.getBlockState();
|
||||
|
||||
matrixStack.pushPose();
|
||||
|
||||
|
||||
matrixStack.translate(0.5D, 0.5D, 0.5D);
|
||||
float angle = -((float) (state.getValue(StandingSignBlock.ROTATION) * 360) / 16.0F);
|
||||
|
||||
BlockState blockState = signBlockEntity.getBlockState();
|
||||
if (blockState.getValue(BaseSignBlock.FLOOR)) {
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(angle));
|
||||
model.stick.visible = true;
|
||||
} else {
|
||||
matrixStack.mulPose(Vector3f.YP.rotationDegrees(angle + 180));
|
||||
matrixStack.translate(0.0D, -0.3125D, -0.4375D);
|
||||
model.stick.visible = false;
|
||||
}
|
||||
|
||||
matrixStack.pushPose();
|
||||
matrixStack.scale(0.6666667F, -0.6666667F, -0.6666667F);
|
||||
VertexConsumer vertexConsumer = getConsumer(provider, state.getBlock());
|
||||
|
||||
model.root.render(matrixStack, vertexConsumer, light, overlay);
|
||||
matrixStack.popPose();
|
||||
matrixStack.translate(0.0D, 0.3333333432674408D, 0.046666666865348816D);
|
||||
matrixStack.scale(0.010416667F, -0.010416667F, 0.010416667F);
|
||||
int m = signBlockEntity.getColor().getTextColor();
|
||||
int n = (int) (NativeImage.getR(m) * 0.4D);
|
||||
int o = (int) (NativeImage.getG(m) * 0.4D);
|
||||
int p = (int) (NativeImage.getB(m) * 0.4D);
|
||||
int q = NativeImage.combine(0, p, o, n);
|
||||
|
||||
FormattedCharSequence[] formattedCharSequences = signBlockEntity.getRenderMessages(
|
||||
Minecraft.getInstance()
|
||||
.isTextFilteringEnabled(),
|
||||
(component) -> {
|
||||
List<FormattedCharSequence> list = this.font.split(component, 90);
|
||||
return list.isEmpty() ? FormattedCharSequence.EMPTY : list.get(0);
|
||||
}
|
||||
);
|
||||
int drawColor;
|
||||
boolean drawOutlined;
|
||||
int drawLight;
|
||||
if (signBlockEntity.hasGlowingText()) {
|
||||
drawColor = signBlockEntity.getColor().getTextColor();
|
||||
drawOutlined = isOutlineVisible(signBlockEntity, drawColor);
|
||||
drawLight = 15728880;
|
||||
} else {
|
||||
drawColor = m;
|
||||
drawOutlined = false;
|
||||
drawLight = light;
|
||||
}
|
||||
|
||||
for (int s = 0; s < 4; ++s) {
|
||||
FormattedCharSequence formattedCharSequence = formattedCharSequences[s];
|
||||
float t = (float) (-this.font.width(formattedCharSequence) / 2);
|
||||
if (drawOutlined) {
|
||||
this.font.drawInBatch8xOutline(
|
||||
formattedCharSequence,
|
||||
t,
|
||||
(float) (s * 10 - 20),
|
||||
drawColor,
|
||||
m,
|
||||
matrixStack.last().pose(),
|
||||
provider,
|
||||
drawLight
|
||||
);
|
||||
} else {
|
||||
this.font.drawInBatch(
|
||||
formattedCharSequence,
|
||||
t,
|
||||
(float) (s * 10 - 20),
|
||||
drawColor,
|
||||
false,
|
||||
matrixStack.last().pose(),
|
||||
provider,
|
||||
false,
|
||||
0,
|
||||
drawLight
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
|
||||
private static boolean isOutlineVisible(BaseSignBlockEntity signBlockEntity, int i) {
|
||||
if (i == DyeColor.BLACK.getTextColor()) {
|
||||
return true;
|
||||
} else {
|
||||
Minecraft minecraft = Minecraft.getInstance();
|
||||
LocalPlayer localPlayer = minecraft.player;
|
||||
if (localPlayer != null && minecraft.options.getCameraType().isFirstPerson() && localPlayer.isScoping()) {
|
||||
return true;
|
||||
} else {
|
||||
Entity entity = minecraft.getCameraEntity();
|
||||
return entity != null && entity.distanceToSqr(Vec3.atCenterOf(signBlockEntity.getBlockPos())) < (double) OUTLINE_RENDER_DISTANCE;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static WoodType getSignType(Block block) {
|
||||
WoodType signType2;
|
||||
if (block instanceof SignBlock) {
|
||||
signType2 = ((SignBlock) block).type();
|
||||
} else {
|
||||
signType2 = WoodType.OAK;
|
||||
}
|
||||
|
||||
return signType2;
|
||||
}
|
||||
|
||||
public static Material getModelTexture(Block block) {
|
||||
return Sheets.getSignMaterial(getSignType(block));
|
||||
}
|
||||
|
||||
public static VertexConsumer getConsumer(MultiBufferSource provider, Block block) {
|
||||
return provider.getBuffer(RENDER_TYPES.getOrDefault(block, RENDER_TYPE));
|
||||
}
|
||||
|
||||
public static void registerRenderLayer(Block block) {
|
||||
ResourceLocation blockId = Registry.BLOCK.getKey(block);
|
||||
RenderType layer = RenderType.entitySolid(new ResourceLocation(blockId.getNamespace(),
|
||||
"textures/entity/sign/" + blockId.getPath() + ".png"));
|
||||
RENDER_TYPES.put(block, layer);
|
||||
}
|
||||
|
||||
static {
|
||||
RENDER_TYPE = RenderType.entitySolid(new ResourceLocation("textures/entity/signs/oak.png"));
|
||||
}
|
||||
}
|
|
@ -0,0 +1,155 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.effect.MobEffectInstance;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.Entity;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import org.betterx.bclib.api.biomes.BiomeAPI;
|
||||
import org.betterx.bclib.config.Configs;
|
||||
import org.betterx.bclib.util.BackgroundInfo;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.bclib.world.biomes.BCLBiome;
|
||||
|
||||
public class CustomFogRenderer {
|
||||
private static final MutableBlockPos LAST_POS = new MutableBlockPos(0, -100, 0);
|
||||
private static final MutableBlockPos MUT_POS = new MutableBlockPos();
|
||||
private static final float[] FOG_DENSITY = new float[8];
|
||||
private static final int GRID_SIZE = 32;
|
||||
private static float fogStart = 0;
|
||||
private static float fogEnd = 192;
|
||||
|
||||
public static boolean applyFogDensity(Camera camera, float viewDistance, boolean thickFog) {
|
||||
if (!Configs.CLIENT_CONFIG.renderCustomFog()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
FogType fogType = camera.getFluidInCamera();
|
||||
if (fogType != FogType.NONE) {
|
||||
BackgroundInfo.fogDensity = 1;
|
||||
return false;
|
||||
}
|
||||
Entity entity = camera.getEntity();
|
||||
|
||||
if (!isForcedDimension(entity.level) && shouldIgnoreArea(entity.level,
|
||||
(int) entity.getX(),
|
||||
(int) entity.getEyeY(),
|
||||
(int) entity.getZ())) {
|
||||
BackgroundInfo.fogDensity = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
float fog = getFogDensity(entity.level, entity.getX(), entity.getEyeY(), entity.getZ());
|
||||
BackgroundInfo.fogDensity = fog;
|
||||
|
||||
if (thickFog(thickFog, entity.level)) {
|
||||
fogStart = viewDistance * 0.05F / fog;
|
||||
fogEnd = Math.min(viewDistance, 192.0F) * 0.5F / fog;
|
||||
} else {
|
||||
fogStart = viewDistance * 0.25F / fog; // In vanilla - 0
|
||||
fogEnd = viewDistance / fog;
|
||||
}
|
||||
|
||||
if (entity instanceof LivingEntity) {
|
||||
LivingEntity livingEntity = (LivingEntity) entity;
|
||||
MobEffectInstance effect = livingEntity.getEffect(MobEffects.BLINDNESS);
|
||||
if (effect != null) {
|
||||
int duration = effect.getDuration();
|
||||
if (duration > 20) {
|
||||
fogStart = 0;
|
||||
fogEnd *= 0.03F;
|
||||
BackgroundInfo.blindness = 1;
|
||||
} else {
|
||||
float delta = (float) duration / 20F;
|
||||
BackgroundInfo.blindness = delta;
|
||||
fogStart = Mth.lerp(delta, fogStart, 0);
|
||||
fogEnd = Mth.lerp(delta, fogEnd, fogEnd * 0.03F);
|
||||
}
|
||||
} else {
|
||||
BackgroundInfo.blindness = 0;
|
||||
}
|
||||
}
|
||||
|
||||
RenderSystem.setShaderFogStart(fogStart);
|
||||
RenderSystem.setShaderFogEnd(fogEnd);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean thickFog(boolean thickFog, Level level) {
|
||||
if (!thickFog) {
|
||||
return false;
|
||||
}
|
||||
if (level.dimension() == Level.NETHER) {
|
||||
return Configs.CLIENT_CONFIG.netherThickFog();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean isForcedDimension(Level level) {
|
||||
return level.dimension() == Level.END || level.dimension() == Level.NETHER;
|
||||
}
|
||||
|
||||
private static boolean shouldIgnoreArea(Level level, int x, int y, int z) {
|
||||
for (int i = -8; i <= 8; i += 8) {
|
||||
for (int j = -8; j <= 8; j += 8) {
|
||||
if (!shouldIgnore(level, x + i, y, z + j)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
private static boolean shouldIgnore(Level level, int x, int y, int z) {
|
||||
Biome biome = level.getBiome(MUT_POS.set(x, y, z)).value();
|
||||
return BiomeAPI.getRenderBiome(biome) == BiomeAPI.EMPTY_BIOME;
|
||||
}
|
||||
|
||||
private static float getFogDensityI(Level level, int x, int y, int z) {
|
||||
Biome biome = level.getBiome(MUT_POS.set(x, y, z)).value();
|
||||
BCLBiome renderBiome = BiomeAPI.getRenderBiome(biome);
|
||||
return renderBiome.getFogDensity();
|
||||
}
|
||||
|
||||
private static float getFogDensity(Level level, double x, double y, double z) {
|
||||
int x1 = MHelper.floor(x / GRID_SIZE) * GRID_SIZE;
|
||||
int y1 = MHelper.floor(y / GRID_SIZE) * GRID_SIZE;
|
||||
int z1 = MHelper.floor(z / GRID_SIZE) * GRID_SIZE;
|
||||
float dx = (float) (x - x1) / GRID_SIZE;
|
||||
float dy = (float) (y - y1) / GRID_SIZE;
|
||||
float dz = (float) (z - z1) / GRID_SIZE;
|
||||
|
||||
if (LAST_POS.getX() != x1 || LAST_POS.getY() != y1 || LAST_POS.getZ() != z1) {
|
||||
int x2 = x1 + GRID_SIZE;
|
||||
int y2 = y1 + GRID_SIZE;
|
||||
int z2 = z1 + GRID_SIZE;
|
||||
LAST_POS.set(x1, y1, z1);
|
||||
FOG_DENSITY[0] = getFogDensityI(level, x1, y1, z1);
|
||||
FOG_DENSITY[1] = getFogDensityI(level, x2, y1, z1);
|
||||
FOG_DENSITY[2] = getFogDensityI(level, x1, y2, z1);
|
||||
FOG_DENSITY[3] = getFogDensityI(level, x2, y2, z1);
|
||||
FOG_DENSITY[4] = getFogDensityI(level, x1, y1, z2);
|
||||
FOG_DENSITY[5] = getFogDensityI(level, x2, y1, z2);
|
||||
FOG_DENSITY[6] = getFogDensityI(level, x1, y2, z2);
|
||||
FOG_DENSITY[7] = getFogDensityI(level, x2, y2, z2);
|
||||
}
|
||||
|
||||
float a = Mth.lerp(dx, FOG_DENSITY[0], FOG_DENSITY[1]);
|
||||
float b = Mth.lerp(dx, FOG_DENSITY[2], FOG_DENSITY[3]);
|
||||
float c = Mth.lerp(dx, FOG_DENSITY[4], FOG_DENSITY[5]);
|
||||
float d = Mth.lerp(dx, FOG_DENSITY[6], FOG_DENSITY[7]);
|
||||
|
||||
a = Mth.lerp(dy, a, b);
|
||||
b = Mth.lerp(dy, c, d);
|
||||
|
||||
return Mth.lerp(dz, a, b);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.Set;
|
||||
|
||||
public class EmissiveTextureInfo {
|
||||
private static final Set<ResourceLocation> EMISSIVE_TEXTURES = Sets.newHashSet();
|
||||
private static final Set<ResourceLocation> EMISSIVE_BLOCKS = Sets.newHashSet();
|
||||
|
||||
public static void clear() {
|
||||
EMISSIVE_TEXTURES.clear();
|
||||
EMISSIVE_BLOCKS.clear();
|
||||
}
|
||||
|
||||
public static void addTexture(ResourceLocation texture) {
|
||||
EMISSIVE_TEXTURES.add(texture);
|
||||
}
|
||||
|
||||
public static void addBlock(ResourceLocation blockID) {
|
||||
EMISSIVE_BLOCKS.add(blockID);
|
||||
}
|
||||
|
||||
public static boolean isEmissiveTexture(ResourceLocation texture) {
|
||||
return EMISSIVE_TEXTURES.contains(texture);
|
||||
}
|
||||
|
||||
public static boolean isEmissiveBlock(ResourceLocation blockID) {
|
||||
return EMISSIVE_BLOCKS.contains(blockID);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue