mirror of
https://github.com/Creators-of-Create/Create.git
synced 2025-03-04 06:44:40 +01:00
Tech service
- Stock keeper categories with no filter item now get removed - Stock keeper ui now plays a sound when showing or hiding a category - Fixed table cloth price jumping to 64 when set to 1 - Reset alpha on gl shader color after rendering schematic tool bar - Contained Spawn eggs are no longer listed in the package item tooltip - Smart observers now trigger when a targeted conveyor has looping packages - Added a dedicated display source to smart observers for reading package addresses (datagen pending)
This commit is contained in:
parent
3e10dbe4bc
commit
8b2bd203d0
11 changed files with 113 additions and 21 deletions
|
@ -1790,6 +1790,7 @@ public class AllBlocks {
|
|||
.transform(displaySource(AllDisplaySources.LIST_ITEMS))
|
||||
.transform(displaySource(AllDisplaySources.COUNT_FLUIDS))
|
||||
.transform(displaySource(AllDisplaySources.LIST_FLUIDS))
|
||||
.transform(displaySource(AllDisplaySources.READ_PACKAGE_ADDRESS))
|
||||
.lang("Smart Observer")
|
||||
.item()
|
||||
.transform(customItemModel("_", "block"))
|
||||
|
|
|
@ -21,6 +21,7 @@ import com.simibubi.create.content.redstone.displayLink.source.KineticSpeedDispl
|
|||
import com.simibubi.create.content.redstone.displayLink.source.KineticStressDisplaySource;
|
||||
import com.simibubi.create.content.redstone.displayLink.source.NixieTubeDisplaySource;
|
||||
import com.simibubi.create.content.redstone.displayLink.source.ObservedTrainNameSource;
|
||||
import com.simibubi.create.content.redstone.displayLink.source.PackageAddressDisplaySource;
|
||||
import com.simibubi.create.content.redstone.displayLink.source.RedstonePowerDisplaySource;
|
||||
import com.simibubi.create.content.redstone.displayLink.source.ScoreboardDisplaySource;
|
||||
import com.simibubi.create.content.redstone.displayLink.source.StationSummaryDisplaySource;
|
||||
|
@ -82,6 +83,7 @@ public class AllDisplaySources {
|
|||
public static final RegistryEntry<ItemListDisplaySource> LIST_ITEMS = simple("list_items", ItemListDisplaySource::new);
|
||||
public static final RegistryEntry<FluidAmountDisplaySource> COUNT_FLUIDS = simple("count_fluids", FluidAmountDisplaySource::new);
|
||||
public static final RegistryEntry<FluidListDisplaySource> LIST_FLUIDS = simple("list_fluids", FluidListDisplaySource::new);
|
||||
public static final RegistryEntry<PackageAddressDisplaySource> READ_PACKAGE_ADDRESS = simple("read_package_address", PackageAddressDisplaySource::new);
|
||||
|
||||
public static final RegistryEntry<ComputerDisplaySource> COMPUTER = REGISTRATE.displaySource("computer", ComputerDisplaySource::new)
|
||||
.onRegisterAfter(Registries.BLOCK_ENTITY_TYPE, source -> {
|
||||
|
|
|
@ -41,7 +41,6 @@ import net.minecraft.world.item.context.UseOnContext;
|
|||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.phys.AABB;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
|
||||
import net.minecraftforge.items.ItemHandlerHelper;
|
||||
import net.minecraftforge.items.ItemStackHandler;
|
||||
|
||||
|
@ -229,6 +228,8 @@ public class PackageItem extends Item {
|
|||
ItemStack itemstack = contents.getStackInSlot(i);
|
||||
if (itemstack.isEmpty())
|
||||
continue;
|
||||
if (itemstack.getItem() instanceof SpawnEggItem)
|
||||
continue;
|
||||
if (visibleNames > 2) {
|
||||
skippedNames++;
|
||||
continue;
|
||||
|
|
|
@ -126,15 +126,21 @@ public class StockKeeperCategoryScreen extends AbstractSimiContainerScreen<Stock
|
|||
|
||||
ItemStack stackInSlot = menu.proxyInventory.getStackInSlot(0)
|
||||
.copy();
|
||||
if (!stackInSlot.isEmpty()) {
|
||||
stackInSlot.setHoverName(Component.literal(editorEditBox.getValue()));
|
||||
boolean empty = stackInSlot.isEmpty();
|
||||
|
||||
if (empty && editingIndex != -1)
|
||||
schedule.remove(editingIndex);
|
||||
|
||||
if (!empty) {
|
||||
String value = editorEditBox.getValue();
|
||||
stackInSlot.setHoverName(value.isBlank() ? null : Component.literal(value));
|
||||
|
||||
if (editingIndex == -1)
|
||||
schedule.add(stackInSlot);
|
||||
else
|
||||
schedule.set(editingIndex, stackInSlot);
|
||||
}
|
||||
|
||||
if (editingIndex == -1)
|
||||
schedule.add(stackInSlot);
|
||||
else
|
||||
schedule.set(editingIndex, stackInSlot);
|
||||
|
||||
AllPackets.getChannel()
|
||||
.sendToServer(new GhostItemSubmitPacket(ItemStack.EMPTY, 0));
|
||||
|
||||
|
|
|
@ -262,7 +262,7 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
|
|||
|
||||
extraAreas.add(new Rect2i(0, y + windowHeight - 15 - leftHeight, x, height));
|
||||
if (encodeRequester)
|
||||
extraAreas.add(new Rect2i(x + windowWidth, y + windowHeight - 15 - rightHeight, rightHeight, rightHeight));
|
||||
extraAreas.add(new Rect2i(x + windowWidth, y + windowHeight - 15 - rightHeight, rightHeight + 10, rightHeight));
|
||||
|
||||
if (initial) {
|
||||
playUiSound(SoundEvents.WOOD_HIT, 0.5f, 1.5f);
|
||||
|
@ -1078,9 +1078,16 @@ public class StockKeeperRequestScreen extends AbstractSimiContainerScreen<StockK
|
|||
if (indexOf >= blockEntity.categories.size())
|
||||
continue;
|
||||
|
||||
hiddenCategories.remove(indexOf);
|
||||
if (!entry.hidden)
|
||||
if (!entry.hidden) {
|
||||
hiddenCategories.add(indexOf);
|
||||
playUiSound(SoundEvents.ITEM_FRAME_ROTATE_ITEM, 0.75f, 1.5f);
|
||||
}
|
||||
|
||||
else {
|
||||
hiddenCategories.remove(indexOf);
|
||||
playUiSound(SoundEvents.ITEM_FRAME_ROTATE_ITEM, 0.75f, 0.675f);
|
||||
}
|
||||
|
||||
refreshSearchNextTick = true;
|
||||
moveToTopNextTick = false;
|
||||
return true;
|
||||
|
|
|
@ -18,7 +18,7 @@ public class TableClothFilteringBehaviour extends FilteringBehaviour {
|
|||
|
||||
public TableClothFilteringBehaviour(TableClothBlockEntity be) {
|
||||
super(be, new TableClothFilterSlot(be));
|
||||
withPredicate(is -> !(is.getItem() instanceof FilterItem));
|
||||
withPredicate(is -> !(is.getItem() instanceof FilterItem) && !(is.getItem() instanceof ShoppingListItem));
|
||||
count = 1;
|
||||
}
|
||||
|
||||
|
@ -68,7 +68,7 @@ public class TableClothFilteringBehaviour extends FilteringBehaviour {
|
|||
public void setValueSettings(Player player, ValueSettings settings, boolean ctrlDown) {
|
||||
if (getValueSettings().equals(settings))
|
||||
return;
|
||||
count = settings.value();
|
||||
count = Math.max(1, settings.value());
|
||||
blockEntity.setChanged();
|
||||
blockEntity.sendData();
|
||||
playFeedbackSound(this);
|
||||
|
|
|
@ -4,7 +4,6 @@ import org.apache.commons.lang3.mutable.MutableObject;
|
|||
|
||||
import com.simibubi.create.content.kinetics.belt.behaviour.TransportedItemStackHandlerBehaviour;
|
||||
import com.simibubi.create.content.kinetics.belt.behaviour.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||
import com.simibubi.create.content.logistics.box.PackageItem;
|
||||
import com.simibubi.create.content.redstone.displayLink.DisplayLinkBlockEntity;
|
||||
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
|
||||
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
|
||||
|
@ -12,7 +11,6 @@ import com.simibubi.create.foundation.blockEntity.behaviour.BlockEntityBehaviour
|
|||
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
|
@ -42,12 +40,8 @@ public class ItemNameDisplaySource extends SingleLineDisplaySource {
|
|||
});
|
||||
|
||||
ItemStack stack = stackHolder.getValue();
|
||||
if (stack != null && !stack.isEmpty()) {
|
||||
Component hoverName = stack.getHoverName();
|
||||
if (PackageItem.isPackage(stack))
|
||||
hoverName = Component.literal(PackageItem.getAddress(stack));
|
||||
combined = combined.append(hoverName);
|
||||
}
|
||||
if (stack != null && !stack.isEmpty())
|
||||
combined = combined.append(stack.getHoverName());
|
||||
}
|
||||
|
||||
return combined;
|
||||
|
|
|
@ -0,0 +1,67 @@
|
|||
package com.simibubi.create.content.redstone.displayLink.source;
|
||||
|
||||
import com.simibubi.create.content.kinetics.chainConveyor.ChainConveyorBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.chainConveyor.ChainConveyorPackage;
|
||||
import com.simibubi.create.content.logistics.box.PackageItem;
|
||||
import com.simibubi.create.content.redstone.displayLink.DisplayLinkContext;
|
||||
import com.simibubi.create.content.redstone.displayLink.target.DisplayTargetStats;
|
||||
import com.simibubi.create.content.redstone.smartObserver.SmartObserverBlock;
|
||||
import com.simibubi.create.content.redstone.smartObserver.SmartObserverBlockEntity;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.filtering.FilteringBehaviour;
|
||||
import com.simibubi.create.foundation.blockEntity.behaviour.inventory.InvManipulationBehaviour;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.MutableComponent;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.block.entity.BlockEntity;
|
||||
import net.minecraftforge.items.IItemHandler;
|
||||
|
||||
public class PackageAddressDisplaySource extends SingleLineDisplaySource {
|
||||
|
||||
@Override
|
||||
protected MutableComponent provideLine(DisplayLinkContext context, DisplayTargetStats stats) {
|
||||
BlockEntity sourceBE = context.getSourceBlockEntity();
|
||||
if (!(sourceBE instanceof SmartObserverBlockEntity cobe))
|
||||
return EMPTY_LINE;
|
||||
|
||||
InvManipulationBehaviour invManipulationBehaviour = cobe.getBehaviour(InvManipulationBehaviour.TYPE);
|
||||
FilteringBehaviour filteringBehaviour = cobe.getBehaviour(FilteringBehaviour.TYPE);
|
||||
IItemHandler handler = invManipulationBehaviour.getInventory();
|
||||
|
||||
if (handler == null) {
|
||||
BlockPos targetPos = cobe.getBlockPos().relative(SmartObserverBlock.getTargetDirection(cobe.getBlockState()));
|
||||
|
||||
if (context.level().getBlockEntity(targetPos) instanceof ChainConveyorBlockEntity ccbe)
|
||||
for (ChainConveyorPackage box : ccbe.getLoopingPackages())
|
||||
if (filteringBehaviour.test(box.item))
|
||||
return Component.literal(PackageItem.getAddress(box.item));
|
||||
|
||||
return EMPTY_LINE;
|
||||
}
|
||||
|
||||
for (int i = 0; i < handler.getSlots(); i++) {
|
||||
ItemStack stack = handler.getStackInSlot(i);
|
||||
if (PackageItem.isPackage(stack) && filteringBehaviour.test(stack))
|
||||
return Component.literal(PackageItem.getAddress(stack));
|
||||
}
|
||||
|
||||
return EMPTY_LINE;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTranslationKey() {
|
||||
return "read_package_address";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean allowsLabeling(DisplayLinkContext context) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFlapDisplayLayoutName(DisplayLinkContext context) {
|
||||
return "Default";
|
||||
}
|
||||
|
||||
}
|
|
@ -6,6 +6,8 @@ import com.simibubi.create.content.fluids.FluidTransportBehaviour;
|
|||
import com.simibubi.create.content.fluids.PipeConnection.Flow;
|
||||
import com.simibubi.create.content.kinetics.belt.behaviour.TransportedItemStackHandlerBehaviour;
|
||||
import com.simibubi.create.content.kinetics.belt.behaviour.TransportedItemStackHandlerBehaviour.TransportedResult;
|
||||
import com.simibubi.create.content.kinetics.chainConveyor.ChainConveyorBlockEntity;
|
||||
import com.simibubi.create.content.kinetics.chainConveyor.ChainConveyorPackage;
|
||||
import com.simibubi.create.content.redstone.DirectedDirectionalBlock;
|
||||
import com.simibubi.create.content.redstone.FilteredDetectorFilterSlot;
|
||||
import com.simibubi.create.foundation.blockEntity.SmartBlockEntity;
|
||||
|
@ -111,6 +113,16 @@ public class SmartObserverBlockEntity extends SmartBlockEntity {
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Detect packages looping on a chain conveyor
|
||||
if (level.getBlockEntity(targetPos) instanceof ChainConveyorBlockEntity ccbe) {
|
||||
for (ChainConveyorPackage box : ccbe.getLoopingPackages())
|
||||
if (filtering.test(box.item)) {
|
||||
activate();
|
||||
return;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if (observedInventory.hasInventory()) {
|
||||
boolean skipInv = invVersionTracker.stillWaiting(observedInventory);
|
||||
|
|
|
@ -137,6 +137,7 @@ public class ToolSelectionScreen extends Screen {
|
|||
matrixStack.popPose();
|
||||
}
|
||||
|
||||
RenderSystem.setShaderColor(1, 1, 1, 1);
|
||||
RenderSystem.disableBlend();
|
||||
matrixStack.popPose();
|
||||
}
|
||||
|
|
|
@ -1139,6 +1139,7 @@
|
|||
"create.display_source.list_items": "List matching Items",
|
||||
"create.display_source.fluid_amount": "Amount of matching Fluids",
|
||||
"create.display_source.list_fluids": "List matching Fluids",
|
||||
"create.display_source.read_package_address": "Read Package Address",
|
||||
"create.display_source.nixie_tube": "Copy Nixie Tubes",
|
||||
"create.display_source.fill_level": "Container Fill Level",
|
||||
"create.display_source.fill_level.display": "Display Format",
|
||||
|
|
Loading…
Add table
Reference in a new issue