Code style fix, interface rename, custom item getter
This commit is contained in:
parent
179ada3296
commit
c6afa74529
134 changed files with 3404 additions and 1244 deletions
|
@ -51,7 +51,11 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
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);
|
||||
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) {
|
||||
|
@ -72,23 +76,54 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
propertySource = DoubleBlockCombiner.Combiner::acceptNone;
|
||||
}
|
||||
|
||||
float pitch = ((Float2FloatFunction) propertySource.apply(ChestBlock.opennessCombiner(entity))).get(tickDelta);
|
||||
float pitch = ((Float2FloatFunction) 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);
|
||||
@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);
|
||||
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);
|
||||
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);
|
||||
renderParts(
|
||||
matrices,
|
||||
vertexConsumer,
|
||||
chestModel.partA,
|
||||
chestModel.partB,
|
||||
chestModel.partC,
|
||||
pitch,
|
||||
blockLight,
|
||||
overlay
|
||||
);
|
||||
}
|
||||
|
||||
matrices.popPose();
|
||||
|
@ -120,10 +155,24 @@ public class BaseChestBlockEntityRenderer implements BlockEntityRenderer<BaseChe
|
|||
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"))});
|
||||
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 {
|
||||
defaultLayer = 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"))};
|
||||
defaultLayer = 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"))
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -87,10 +87,14 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
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 : (FormattedCharSequence) list.get(0);
|
||||
});
|
||||
FormattedCharSequence[] formattedCharSequences = signBlockEntity.getRenderMessages(
|
||||
Minecraft.getInstance()
|
||||
.isTextFilteringEnabled(),
|
||||
(component) -> {
|
||||
List<FormattedCharSequence> list = this.font.split(component, 90);
|
||||
return list.isEmpty() ? FormattedCharSequence.EMPTY : (FormattedCharSequence) list.get(0);
|
||||
}
|
||||
);
|
||||
int drawColor;
|
||||
boolean drawOutlined;
|
||||
int drawLight;
|
||||
|
@ -109,10 +113,30 @@ public class BaseSignBlockEntityRenderer implements BlockEntityRenderer<BaseSign
|
|||
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);
|
||||
this.font.drawInBatch8xOutline(
|
||||
formattedCharSequence,
|
||||
t,
|
||||
(float) (s * 10 - 20),
|
||||
drawColor,
|
||||
m,
|
||||
matrixStack.last().pose(),
|
||||
provider,
|
||||
drawLight
|
||||
);
|
||||
}
|
||||
else {
|
||||
this.font.drawInBatch((FormattedCharSequence) formattedCharSequence, t, (float) (s * 10 - 20), drawColor, false, matrixStack.last().pose(), provider, false, 0, drawLight);
|
||||
this.font.drawInBatch(
|
||||
(FormattedCharSequence) formattedCharSequence,
|
||||
t,
|
||||
(float) (s * 10 - 20),
|
||||
drawColor,
|
||||
false,
|
||||
matrixStack.last().pose(),
|
||||
provider,
|
||||
false,
|
||||
0,
|
||||
drawLight
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -160,7 +184,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"
|
||||
));
|
||||
LAYERS.put(block, layer);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue