Search in sources :

Example 1 with ScrollOptionBehaviour

use of com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour in project Create by Creators-of-Create.

the class BrassTunnelTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    behaviours.add(selectionMode = new ScrollOptionBehaviour<>(SelectionMode.class, Lang.translate("logistics.when_multiple_outputs_available"), this, new CenteredSideValueBoxTransform((state, d) -> d == Direction.UP)));
    selectionMode.requiresWrench();
    // Propagate settings across connected tunnels
    selectionMode.withCallback(setting -> {
        for (boolean side : Iterate.trueAndFalse) {
            if (!isConnected(side))
                continue;
            BrassTunnelTileEntity adjacent = getAdjacent(side);
            if (adjacent != null)
                adjacent.selectionMode.setValue(setting);
        }
    });
}
Also used : IItemHandler(net.minecraftforge.items.IItemHandler) Direction(net.minecraft.core.Direction) Random(java.util.Random) AxisDirection(net.minecraft.core.Direction.AxisDirection) Pair(org.apache.commons.lang3.tuple.Pair) ChatFormatting(net.minecraft.ChatFormatting) Map(java.util.Map) TranslatableComponent(net.minecraft.network.chat.TranslatableComponent) CenteredSideValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform) IdentityHashMap(java.util.IdentityHashMap) NbtUtils(net.minecraft.nbt.NbtUtils) Set(java.util.Set) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) Capability(net.minecraftforge.common.capabilities.Capability) BlockHelper(com.simibubi.create.foundation.utility.BlockHelper) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) Couple(com.simibubi.create.foundation.utility.Couple) BlockPos(net.minecraft.core.BlockPos) ItemEntity(net.minecraft.world.entity.item.ItemEntity) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) CapabilityItemHandler(net.minecraftforge.items.CapabilityItemHandler) Entry(java.util.Map.Entry) ItemStack(net.minecraft.world.item.ItemStack) Tag(net.minecraft.nbt.Tag) BlockState(net.minecraft.world.level.block.state.BlockState) BeltHelper(com.simibubi.create.content.contraptions.relays.belt.BeltHelper) ScrollOptionBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour) AllIcons(com.simibubi.create.foundation.gui.AllIcons) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) ArrayList(java.util.ArrayList) LazyOptional(net.minecraftforge.common.util.LazyOptional) HashSet(java.util.HashSet) Axis(net.minecraft.core.Direction.Axis) SidedFilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.SidedFilteringBehaviour) ItemHandlerHelper(net.minecraftforge.items.ItemHandlerHelper) INamedIconOptions(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions) Lang(com.simibubi.create.foundation.utility.Lang) AllBlocks(com.simibubi.create.AllBlocks) Nullable(javax.annotation.Nullable) Iterate(com.simibubi.create.foundation.utility.Iterate) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) Component(net.minecraft.network.chat.Component) AllTriggers(com.simibubi.create.foundation.advancement.AllTriggers) BeltTileEntity(com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity) IHaveGoggleInformation(com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation) Vec3(net.minecraft.world.phys.Vec3) NBTHelper(com.simibubi.create.foundation.utility.NBTHelper) DirectBeltInputBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour) ScrollOptionBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour) CenteredSideValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform)

Aggregations

AllBlocks (com.simibubi.create.AllBlocks)1 IHaveGoggleInformation (com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation)1 BeltHelper (com.simibubi.create.content.contraptions.relays.belt.BeltHelper)1 BeltTileEntity (com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity)1 AllTriggers (com.simibubi.create.foundation.advancement.AllTriggers)1 AllIcons (com.simibubi.create.foundation.gui.AllIcons)1 TileEntityBehaviour (com.simibubi.create.foundation.tileEntity.TileEntityBehaviour)1 CenteredSideValueBoxTransform (com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform)1 DirectBeltInputBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour)1 FilteringBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour)1 SidedFilteringBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.filtering.SidedFilteringBehaviour)1 INamedIconOptions (com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions)1 ScrollOptionBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour)1 BlockHelper (com.simibubi.create.foundation.utility.BlockHelper)1 Couple (com.simibubi.create.foundation.utility.Couple)1 Iterate (com.simibubi.create.foundation.utility.Iterate)1 Lang (com.simibubi.create.foundation.utility.Lang)1 NBTHelper (com.simibubi.create.foundation.utility.NBTHelper)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1