Reformated
This commit is contained in:
parent
079b51e3f6
commit
852e5a6abc
385 changed files with 6924 additions and 5656 deletions
|
@ -1,5 +1,11 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import org.betterx.bclib.blockentities.BaseChestBlockEntity;
|
||||
import org.betterx.bclib.client.models.BaseChestBlockModel;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.client.model.geom.ModelPart;
|
||||
import net.minecraft.client.renderer.MultiBufferSource;
|
||||
import net.minecraft.client.renderer.RenderType;
|
||||
|
@ -20,13 +26,7 @@ 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;
|
||||
|
||||
|
@ -46,19 +46,21 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
chestModel = new BaseChestBlockModel(BaseChestBlockModel.getTexturedModelData().bakeRoot());
|
||||
}
|
||||
|
||||
public void render(BaseChestBlockEntity entity,
|
||||
float tickDelta,
|
||||
PoseStack matrices,
|
||||
MultiBufferSource vertexConsumers,
|
||||
int light,
|
||||
int overlay) {
|
||||
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;
|
||||
|
@ -102,7 +104,7 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
);
|
||||
} else {
|
||||
renderParts(
|
||||
matrices,
|
||||
|
@ -113,7 +115,7 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
);
|
||||
}
|
||||
} else {
|
||||
renderParts(
|
||||
|
@ -125,21 +127,23 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
matrices.popPose();
|
||||
}
|
||||
}
|
||||
|
||||
private void renderParts(PoseStack matrices,
|
||||
VertexConsumer vertices,
|
||||
ModelPart modelPart,
|
||||
ModelPart modelPart2,
|
||||
ModelPart modelPart3,
|
||||
float pitch,
|
||||
int light,
|
||||
int overlay) {
|
||||
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);
|
||||
|
@ -168,12 +172,16 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
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"))
|
||||
RenderType.entityCutout(new ResourceLocation(
|
||||
modId,
|
||||
"textures/entity/chest/" + path + "_left.png"
|
||||
)),
|
||||
RenderType.entityCutout(new ResourceLocation(
|
||||
modId,
|
||||
"textures/entity/chest/" + path + "_right.png"
|
||||
))
|
||||
}
|
||||
);
|
||||
);
|
||||
}
|
||||
|
||||
static {
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import org.betterx.bclib.blockentities.BaseSignBlockEntity;
|
||||
import org.betterx.bclib.blocks.BaseSignBlock;
|
||||
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import com.mojang.blaze3d.vertex.VertexConsumer;
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.model.geom.ModelLayers;
|
||||
|
@ -25,12 +32,6 @@ 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;
|
||||
|
@ -49,12 +50,14 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
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) {
|
||||
public void render(
|
||||
BaseSignBlockEntity signBlockEntity,
|
||||
float tickDelta,
|
||||
PoseStack matrixStack,
|
||||
MultiBufferSource provider,
|
||||
int light,
|
||||
int overlay
|
||||
) {
|
||||
BlockState state = signBlockEntity.getBlockState();
|
||||
|
||||
matrixStack.pushPose();
|
||||
|
@ -94,7 +97,7 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
List<FormattedCharSequence> list = this.font.split(component, 90);
|
||||
return list.isEmpty() ? FormattedCharSequence.EMPTY : list.get(0);
|
||||
}
|
||||
);
|
||||
);
|
||||
int drawColor;
|
||||
boolean drawOutlined;
|
||||
int drawLight;
|
||||
|
@ -121,7 +124,7 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
matrixStack.last().pose(),
|
||||
provider,
|
||||
drawLight
|
||||
);
|
||||
);
|
||||
} else {
|
||||
this.font.drawInBatch(
|
||||
formattedCharSequence,
|
||||
|
@ -134,7 +137,7 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
false,
|
||||
0,
|
||||
drawLight
|
||||
);
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -179,8 +182,10 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
|
||||
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"));
|
||||
RenderType layer = RenderType.entitySolid(new ResourceLocation(
|
||||
blockId.getNamespace(),
|
||||
"textures/entity/sign/" + blockId.getPath() + ".png"
|
||||
));
|
||||
RENDER_TYPES.put(block, layer);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,12 @@
|
|||
package org.betterx.bclib.client.render;
|
||||
|
||||
import org.betterx.bclib.api.v2.levelgen.biomes.BCLBiome;
|
||||
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||
import org.betterx.bclib.config.Configs;
|
||||
import org.betterx.bclib.util.BackgroundInfo;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
|
@ -11,13 +18,6 @@ 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.v2.levelgen.biomes.BCLBiome;
|
||||
import org.betterx.bclib.api.v2.levelgen.biomes.BiomeAPI;
|
||||
import org.betterx.bclib.config.Configs;
|
||||
import org.betterx.bclib.util.BackgroundInfo;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
public class CustomFogRenderer {
|
||||
private static final MutableBlockPos LAST_POS = new MutableBlockPos(0, -100, 0);
|
||||
private static final MutableBlockPos MUT_POS = new MutableBlockPos();
|
||||
|
@ -38,10 +38,12 @@ public class CustomFogRenderer {
|
|||
}
|
||||
Entity entity = camera.getEntity();
|
||||
|
||||
if (!isForcedDimension(entity.level) && shouldIgnoreArea(entity.level,
|
||||
(int) entity.getX(),
|
||||
(int) entity.getEyeY(),
|
||||
(int) entity.getZ())) {
|
||||
if (!isForcedDimension(entity.level) && shouldIgnoreArea(
|
||||
entity.level,
|
||||
(int) entity.getX(),
|
||||
(int) entity.getEyeY(),
|
||||
(int) entity.getZ()
|
||||
)) {
|
||||
BackgroundInfo.fogDensity = 1;
|
||||
return false;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue