mirror of
https://github.com/Creators-of-Create/Create.git
synced 2024-11-10 12:33:57 +01:00
Looking things over
- Minor code cleanup - Bump flywheel build
This commit is contained in:
parent
b66a722826
commit
46ec1dd697
@ -19,7 +19,7 @@ parchment_version = 2022.03.13
|
||||
|
||||
# dependency versions
|
||||
registrate_version = MC1.18.2-1.0.25
|
||||
flywheel_version = 1.18-0.6.2.65
|
||||
flywheel_version = 1.18-0.6.2.66
|
||||
jei_minecraft_version = 1.18.2
|
||||
jei_version = 9.5.3.143
|
||||
|
||||
|
@ -20,14 +20,14 @@ public class ItemListDataSource extends ValueListDataSource {
|
||||
protected Stream<IntAttached<MutableComponent>> provideEntries(DataGathererContext context, int maxRows) {
|
||||
BlockEntity sourceTE = context.getSourceTE();
|
||||
if (!(sourceTE instanceof ContentObserverTileEntity cote))
|
||||
return new ArrayList<IntAttached<MutableComponent>>().stream();
|
||||
return Stream.empty();
|
||||
|
||||
InvManipulationBehaviour invManipulationBehaviour = cote.getBehaviour(InvManipulationBehaviour.TYPE);
|
||||
FilteringBehaviour filteringBehaviour = cote.getBehaviour(FilteringBehaviour.TYPE);
|
||||
IItemHandler handler = invManipulationBehaviour.getInventory();
|
||||
|
||||
if (handler == null)
|
||||
return new ArrayList<IntAttached<MutableComponent>>().stream();
|
||||
return Stream.empty();
|
||||
|
||||
return new CountedItemStackList(handler, filteringBehaviour).getTopNames(maxRows);
|
||||
}
|
||||
|
@ -23,7 +23,7 @@ public class ScoreboardDataSource extends ValueListDataSource {
|
||||
Level level = context.te()
|
||||
.getLevel();
|
||||
if (!(level instanceof ServerLevel sLevel))
|
||||
return new ArrayList<IntAttached<MutableComponent>>().stream();
|
||||
return Stream.empty();
|
||||
|
||||
String name = context.sourceConfig()
|
||||
.getString("Objective");
|
||||
|
@ -26,7 +26,7 @@ public abstract class StatTrackingDataSource extends ScoreboardDataSource {
|
||||
Level level = context.te()
|
||||
.getLevel();
|
||||
if (!(level instanceof ServerLevel sLevel))
|
||||
return new ArrayList<IntAttached<MutableComponent>>().stream();
|
||||
return Stream.empty();
|
||||
|
||||
String name = "create_auto_" + getObjectiveName();
|
||||
Scoreboard scoreboard = level.getScoreboard();
|
||||
|
@ -15,7 +15,6 @@ import com.simibubi.create.foundation.render.CachedBufferer;
|
||||
import com.simibubi.create.foundation.render.SuperByteBuffer;
|
||||
import com.simibubi.create.foundation.utility.AngleHelper;
|
||||
import com.simibubi.create.foundation.utility.AnimationTickHolder;
|
||||
import com.simibubi.create.foundation.utility.DyeHelper;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
@ -74,9 +73,7 @@ public class FlapDisplayRenderer extends KineticTileEntityRenderer {
|
||||
for (int j = 0; j < lines.size(); j++) {
|
||||
List<FlapDisplaySection> line = lines.get(j)
|
||||
.getSections();
|
||||
int color = flapTe.colour[j] == null ? 0xFF_D3C6BA
|
||||
: DyeHelper.DYE_TABLE.get(flapTe.colour[j])
|
||||
.getFirst() | 0xFF_000000;
|
||||
int color = flapTe.getLineColor(j);
|
||||
ms.pushPose();
|
||||
|
||||
float w = 0;
|
||||
@ -116,7 +113,7 @@ public class FlapDisplayRenderer extends KineticTileEntityRenderer {
|
||||
}
|
||||
|
||||
@OnlyIn(Dist.CLIENT)
|
||||
class FlapDisplayRenderOutput implements FormattedCharSink {
|
||||
static class FlapDisplayRenderOutput implements FormattedCharSink {
|
||||
|
||||
final MultiBufferSource bufferSource;
|
||||
final float r, g, b, a;
|
||||
@ -191,7 +188,7 @@ public class FlapDisplayRenderer extends KineticTileEntityRenderer {
|
||||
if (section.renderCharsIndividually())
|
||||
x += (standardWidth - glyphWidth) / 2f;
|
||||
|
||||
if (!(bakedglyph instanceof EmptyGlyph)) {
|
||||
if (isNotEmpty(bakedglyph)) {
|
||||
VertexConsumer vertexconsumer = bufferSource.getBuffer(renderTypeOf(bakedglyph));
|
||||
bakedglyph.render(style.isItalic(), x, 0, pose, vertexconsumer, red, green, blue, a, light);
|
||||
}
|
||||
@ -229,6 +226,10 @@ public class FlapDisplayRenderer extends KineticTileEntityRenderer {
|
||||
return bakedglyph.renderType(Font.DisplayMode.NORMAL);
|
||||
}
|
||||
|
||||
private boolean isNotEmpty(BakedGlyph bakedglyph) {
|
||||
return !(bakedglyph instanceof EmptyGlyph);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -7,6 +7,7 @@ import java.util.List;
|
||||
import com.google.gson.JsonElement;
|
||||
import com.simibubi.create.content.contraptions.base.KineticTileEntity;
|
||||
import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour;
|
||||
import com.simibubi.create.foundation.utility.DyeHelper;
|
||||
import com.simibubi.create.foundation.utility.DynamicComponent;
|
||||
import com.simibubi.create.foundation.utility.NBTHelper;
|
||||
|
||||
@ -276,4 +277,9 @@ public class FlapDisplayTileEntity extends KineticTileEntity {
|
||||
@Override
|
||||
public void addBehaviours(List<TileEntityBehaviour> behaviours) {}
|
||||
|
||||
public int getLineColor(int line) {
|
||||
DyeColor color = colour[line];
|
||||
return color == null ? 0xFF_D3C6BA : DyeHelper.DYE_TABLE.get(color)
|
||||
.getFirst() | 0xFF_000000;
|
||||
}
|
||||
}
|
||||
|
@ -150,10 +150,9 @@ public class TrainHatArmorLayer<T extends LivingEntity, M extends EntityModel<T>
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
public static void registerOn(EntityRenderer<?> entityRenderer) {
|
||||
if (!(entityRenderer instanceof LivingEntityRenderer))
|
||||
if (!(entityRenderer instanceof LivingEntityRenderer<?, ?> livingRenderer))
|
||||
return;
|
||||
|
||||
LivingEntityRenderer<?, ?> livingRenderer = (LivingEntityRenderer<?, ?>) entityRenderer;
|
||||
EntityModel<?> model = livingRenderer.getModel();
|
||||
|
||||
if (!(model instanceof HierarchicalModel) && !(model instanceof AgeableListModel))
|
||||
|
@ -32,7 +32,7 @@ public class PalettesVariantEntry {
|
||||
for (PaletteBlockPattern pattern : paletteStoneVariants.variantTypes) {
|
||||
BlockBuilder<? extends Block, CreateRegistrate> builder =
|
||||
registrate.block(pattern.createName(name), pattern.getBlockFactory())
|
||||
.initialProperties(baseBlock::get)
|
||||
.initialProperties(baseBlock)
|
||||
.transform(pickaxeOnly())
|
||||
.blockstate(pattern.getBlockStateGenerator()
|
||||
.apply(pattern)
|
||||
@ -56,7 +56,7 @@ public class PalettesVariantEntry {
|
||||
.ifPresent(b -> builder.onRegister(connectedTextures(b)));
|
||||
|
||||
builder.recipe((c, p) -> {
|
||||
p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), c::get);
|
||||
p.stonecutting(DataIngredient.tag(paletteStoneVariants.materialTag), c);
|
||||
pattern.addRecipes(baseBlock, c, p);
|
||||
});
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.simibubi.create.foundation.item;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
@ -30,7 +31,7 @@ public class CountedItemStackList {
|
||||
public Stream<IntAttached<MutableComponent>> getTopNames(int limit) {
|
||||
return items.values()
|
||||
.stream()
|
||||
.flatMap(s -> s.stream())
|
||||
.flatMap(Collection::stream)
|
||||
.sorted(IntAttached.comparator())
|
||||
.limit(limit)
|
||||
.map(entry -> IntAttached.with(entry.count(), entry.stack()
|
||||
|
Loading…
Reference in New Issue
Block a user