Search in sources :

Example 1 with ScrollValueBehaviour

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

the class CreativeMotorTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    Integer max = AllConfigs.SERVER.kinetics.maxMotorSpeed.get();
    CenteredSideValueBoxTransform slot = new CenteredSideValueBoxTransform((motor, side) -> motor.getValue(CreativeMotorBlock.FACING) == side.getOpposite());
    generatedSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, slot);
    generatedSpeed.between(-max, max);
    generatedSpeed.value = DEFAULT_SPEED;
    generatedSpeed.scrollableValue = DEFAULT_SPEED;
    generatedSpeed.withUnit(i -> Lang.translate("generic.unit.rpm"));
    generatedSpeed.withCallback(i -> this.updateGeneratedRotation());
    generatedSpeed.withStepFunction(CreativeMotorTileEntity::step);
    behaviours.add(generatedSpeed);
}
Also used : CenteredSideValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour)

Example 2 with ScrollValueBehaviour

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

the class SpeedControllerTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    Integer max = AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
    targetSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, new ControllerValueBoxTransform());
    targetSpeed.between(-max, max);
    targetSpeed.value = DEFAULT_SPEED;
    targetSpeed.moveText(new Vec3(9, 0, 10));
    targetSpeed.withUnit(i -> Lang.translate("generic.unit.rpm"));
    targetSpeed.withCallback(i -> this.updateTargetRotation());
    targetSpeed.withStepFunction(CreativeMotorTileEntity::step);
    behaviours.add(targetSpeed);
}
Also used : Vec3(net.minecraft.world.phys.Vec3) CreativeMotorTileEntity(com.simibubi.create.content.contraptions.components.motor.CreativeMotorTileEntity) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour)

Example 3 with ScrollValueBehaviour

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

the class EjectorTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    behaviours.add(depotBehaviour = new DepotBehaviour(this));
    maxStackSize = new ScrollValueBehaviour(Lang.translate("weighted_ejector.stack_size"), this, new EjectorSlot()).between(0, 64).withFormatter(i -> i == 0 ? "*" : String.valueOf(i)).onlyActiveWhen(() -> state == State.CHARGED).requiresWrench();
    behaviours.add(maxStackSize);
    depotBehaviour.maxStackSize = () -> maxStackSize.getValue();
    depotBehaviour.canAcceptItems = () -> state == State.CHARGED;
    depotBehaviour.canFunnelsPullFrom = side -> side != getFacing();
    depotBehaviour.enableMerging();
    depotBehaviour.addSubBehaviours(behaviours);
}
Also used : VecHelper(com.simibubi.create.foundation.utility.VecHelper) AABB(net.minecraft.world.phys.AABB) Direction(net.minecraft.core.Direction) Dist(net.minecraftforge.api.distmarker.Dist) Chaser(com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser) AllConfigs(com.simibubi.create.foundation.config.AllConfigs) NbtUtils(net.minecraft.nbt.NbtUtils) ValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform) BlockHitResult(net.minecraft.world.phys.BlockHitResult) Capability(net.minecraftforge.common.capabilities.Capability) Player(net.minecraft.world.entity.player.Player) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) BlockPos(net.minecraft.core.BlockPos) ItemEntity(net.minecraft.world.entity.item.ItemEntity) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) ItemStack(net.minecraft.world.item.ItemStack) Type(net.minecraft.world.phys.HitResult.Type) Level(net.minecraft.world.level.Level) AllPackets(com.simibubi.create.foundation.networking.AllPackets) SoundSource(net.minecraft.sounds.SoundSource) Tag(net.minecraft.nbt.Tag) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) EntityType(net.minecraft.world.entity.EntityType) KineticTileEntity(com.simibubi.create.content.contraptions.base.KineticTileEntity) TransformStack(com.jozufozu.flywheel.util.transform.TransformStack) ObserverBlock(net.minecraft.world.level.block.ObserverBlock) BlockState(net.minecraft.world.level.block.state.BlockState) ArrayList(java.util.ArrayList) PoseStack(com.mojang.blaze3d.vertex.PoseStack) LazyOptional(net.minecraftforge.common.util.LazyOptional) Axis(net.minecraft.core.Direction.Axis) PushReaction(net.minecraft.world.level.material.PushReaction) AbstractFunnelBlock(com.simibubi.create.content.logistics.block.funnel.AbstractFunnelBlock) ClipContext(net.minecraft.world.level.ClipContext) SoundEvents(net.minecraft.sounds.SoundEvents) AngleHelper(com.simibubi.create.foundation.utility.AngleHelper) Lang(com.simibubi.create.foundation.utility.Lang) AllBlocks(com.simibubi.create.AllBlocks) Nullable(javax.annotation.Nullable) Iterate(com.simibubi.create.foundation.utility.Iterate) Iterator(java.util.Iterator) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) ElytraItem(net.minecraft.world.item.ElytraItem) Fluid(net.minecraft.world.level.ClipContext.Fluid) Pair(com.simibubi.create.foundation.utility.Pair) IntAttached(com.simibubi.create.foundation.utility.IntAttached) SynchedEntityData(net.minecraft.network.syncher.SynchedEntityData) Block(net.minecraft.world.level.ClipContext.Block) Entity(net.minecraft.world.entity.Entity) Vec3(net.minecraft.world.phys.Vec3) FunnelBlock(com.simibubi.create.content.logistics.block.funnel.FunnelBlock) EquipmentSlot(net.minecraft.world.entity.EquipmentSlot) NBTHelper(com.simibubi.create.foundation.utility.NBTHelper) TransportedItemStack(com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour) DirectBeltInputBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour) Mth(net.minecraft.util.Mth) LerpedFloat(com.simibubi.create.foundation.utility.animation.LerpedFloat) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour)

Example 4 with ScrollValueBehaviour

use of com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour in project Create_Aeronautics by Eriksonnaren.

the class TorsionSpringTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    // Integer max = AllConfigs.SERVER.kinetics.maxRotationSpeed.get();
    maxAngle = new ScrollValueBehaviour(new StringTextComponent("Angle"), this, new TorsionSpringValueBoxTransform());
    maxAngle.between(1, 360);
    maxAngle.value = 90;
    maxAngle.withStepFunction(TorsionSpringTileEntity::step);
    behaviours.add(maxAngle);
    movementMode = new ScrollOptionBehaviour<>(MovementMode.class, Lang.translate("contraptions.movement_mode"), this, new TorsionSpringValueBoxTransform2());
    // behaviours.add(movementMode);
    Pair<ValueBoxTransform, ValueBoxTransform> slots = ValueBoxTransform.Dual.makeSlots(RedstoneLinkFrequencySlot::new);
    SpringBehaviour b = new SpringBehaviour(this, slots);
// behaviours.add(b);
}
Also used : RedstoneLinkFrequencySlot(com.simibubi.create.content.logistics.block.redstone.RedstoneLinkFrequencySlot) ValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour)

Example 5 with ScrollValueBehaviour

use of com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour in project createaddition by mrh0.

the class ElectricMotorTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    CenteredSideValueBoxTransform slot = new CenteredSideValueBoxTransform((motor, side) -> motor.getValue(ElectricMotorBlock.FACING) == side.getOpposite());
    generatedSpeed = new ScrollValueBehaviour(Lang.translate("generic.speed"), this, slot);
    generatedSpeed.between(-RPM_RANGE, RPM_RANGE);
    generatedSpeed.value = DEFAULT_SPEED;
    generatedSpeed.scrollableValue = DEFAULT_SPEED;
    generatedSpeed.withUnit(i -> Lang.translate("generic.unit.rpm"));
    generatedSpeed.withCallback(i -> this.updateGeneratedRotation(i));
    generatedSpeed.withStepFunction(ElectricMotorTileEntity::step);
    behaviours.add(generatedSpeed);
}
Also used : CenteredSideValueBoxTransform(com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform) ScrollValueBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour)

Aggregations

ScrollValueBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour)6 CenteredSideValueBoxTransform (com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform)2 ValueBoxTransform (com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform)2 Vec3 (net.minecraft.world.phys.Vec3)2 TransformStack (com.jozufozu.flywheel.util.transform.TransformStack)1 PoseStack (com.mojang.blaze3d.vertex.PoseStack)1 AllBlocks (com.simibubi.create.AllBlocks)1 KineticTileEntity (com.simibubi.create.content.contraptions.base.KineticTileEntity)1 CreativeMotorTileEntity (com.simibubi.create.content.contraptions.components.motor.CreativeMotorTileEntity)1 TransportedItemStack (com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack)1 AbstractFunnelBlock (com.simibubi.create.content.logistics.block.funnel.AbstractFunnelBlock)1 FunnelBlock (com.simibubi.create.content.logistics.block.funnel.FunnelBlock)1 RedstoneLinkFrequencySlot (com.simibubi.create.content.logistics.block.redstone.RedstoneLinkFrequencySlot)1 AllConfigs (com.simibubi.create.foundation.config.AllConfigs)1 AllPackets (com.simibubi.create.foundation.networking.AllPackets)1 TileEntityBehaviour (com.simibubi.create.foundation.tileEntity.TileEntityBehaviour)1 DirectBeltInputBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour)1 AngleHelper (com.simibubi.create.foundation.utility.AngleHelper)1 IntAttached (com.simibubi.create.foundation.utility.IntAttached)1 Iterate (com.simibubi.create.foundation.utility.Iterate)1