Skip to content

Commit

Permalink
Yeet the monstrosity (no, not that one)
Browse files Browse the repository at this point in the history
  • Loading branch information
Electro593 committed Jan 29, 2025
1 parent 4bfed44 commit 6e000fc
Show file tree
Hide file tree
Showing 11 changed files with 212 additions and 273 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,10 @@ default boolean hasEmptyFilter() {

record ExtendedData(List<ItemVariant> filterItems, int rows, int slotsPerRow, int drawnSlots) {

public ExtendedData(FilterConfigurable configurable) {
this(configurable.getItemFilters(), configurable.getFilterRows(), configurable.getSlotsPerRow(), configurable.getDrawnSlots());
}

public static final PacketCodec<RegistryByteBuf, ExtendedData> PACKET_CODEC = PacketCodec.tuple(
ItemVariant.PACKET_CODEC.collect(PacketCodecs.toList()),
ExtendedData::filterItems,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import de.dafuqs.spectrum.api.energy.*;
import de.dafuqs.spectrum.api.energy.color.*;
import de.dafuqs.spectrum.blocks.*;
import de.dafuqs.spectrum.components.*;
import de.dafuqs.spectrum.registries.*;
import net.minecraft.block.*;
import net.minecraft.block.entity.*;
Expand Down Expand Up @@ -108,15 +107,16 @@ public ItemActionResult onUseWithItem(ItemStack stack, BlockState state, World w

public ItemStack asStackWithColor(InkColor color) {
ItemStack stack = asItem().getDefaultStack();
stack.set(SpectrumDataComponentTypes.OPTIONAL_INK_COLOR, new OptionalInkColorComponent(Optional.of(color)));
stack.set(SpectrumDataComponentTypes.INK_COLOR, color);
return stack;
}

@Override
public void appendTooltip(ItemStack stack, Item.TooltipContext context, List<Text> tooltip, TooltipType type) {
super.appendTooltip(stack, context, tooltip, type);
OptionalInkColorComponent component = stack.getOrDefault(SpectrumDataComponentTypes.OPTIONAL_INK_COLOR, OptionalInkColorComponent.DEFAULT);
component.addTooltip(tooltip);
var color = stack.get(SpectrumDataComponentTypes.INK_COLOR);
if (color != null)
tooltip.add(color.getColoredInkName());
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public static ClientPastelNetworkManager getClientInstance() {
}

public static ServerPastelNetworkManager getServerInstance() {
if (serverManager == null) {
if (serverManager == null && SpectrumCommon.minecraftServer != null) {
serverManager = ServerPastelNetworkManager.get(SpectrumCommon.minecraftServer.getOverworld());
}
return serverManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,7 +229,7 @@ public BlockEntity createBlockEntity(BlockPos pos, BlockState state) {
@Override
public boolean color(World world, BlockPos pos, DyeColor color) {
@Nullable PastelNodeBlockEntity blockEntity = getBlockEntity(world, pos);
if (blockEntity != null) {
if (blockEntity == null) {
return false;
}
return blockEntity.setColor(color);
Expand All @@ -238,10 +238,9 @@ public boolean color(World world, BlockPos pos, DyeColor color) {
@Override
public DyeColor getColor(World world, BlockPos pos) {
@Nullable PastelNodeBlockEntity blockEntity = getBlockEntity(world, pos);
if (blockEntity != null) {
if (blockEntity == null) {
return DyeColor.RED;
}

return blockEntity.getColor().orElse(DyeColor.GRAY);
}

Expand Down
Loading

0 comments on commit 6e000fc

Please sign in to comment.