use of com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform in project Create by Creators-of-Create.
the class LinkRenderer method tick.
public static void tick() {
Minecraft mc = Minecraft.getInstance();
HitResult target = mc.hitResult;
if (target == null || !(target instanceof BlockHitResult))
return;
BlockHitResult result = (BlockHitResult) target;
ClientLevel world = mc.level;
BlockPos pos = result.getBlockPos();
LinkBehaviour behaviour = TileEntityBehaviour.get(world, pos, LinkBehaviour.TYPE);
if (behaviour == null)
return;
Component freq1 = Lang.translate("logistics.firstFrequency");
Component freq2 = Lang.translate("logistics.secondFrequency");
for (boolean first : Iterate.trueAndFalse) {
AABB bb = new AABB(Vec3.ZERO, Vec3.ZERO).inflate(.25f);
Component label = first ? freq1 : freq2;
boolean hit = behaviour.testHit(first, target.getLocation());
ValueBoxTransform transform = first ? behaviour.firstSlot : behaviour.secondSlot;
ValueBox box = new ValueBox(label, bb, pos).withColors(0x601F18, 0xB73C2D).offsetLabel(behaviour.textShift).passive(!hit);
CreateClient.OUTLINER.showValueBox(Pair.of(Boolean.valueOf(first), pos), box.transform(transform)).lineWidth(1 / 64f).withFaceTexture(hit ? AllSpecialTextures.THIN_CHECKERED : null).highlightFace(result.getDirection());
}
}
use of com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform 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);
}
use of com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform in project Create by Creators-of-Create.
the class FilteringRenderer method renderOnTileEntity.
public static void renderOnTileEntity(SmartTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
if (te == null || te.isRemoved())
return;
Entity cameraEntity = Minecraft.getInstance().cameraEntity;
float max = AllConfigs.CLIENT.filterItemRenderDistance.getF();
if (!te.isVirtual() && cameraEntity != null && cameraEntity.position().distanceToSqr(VecHelper.getCenterOf(te.getBlockPos())) > (max * max))
return;
FilteringBehaviour behaviour = te.getBehaviour(FilteringBehaviour.TYPE);
if (behaviour == null)
return;
if (!behaviour.isActive())
return;
if (behaviour.getFilter().isEmpty() && !(behaviour instanceof SidedFilteringBehaviour))
return;
ValueBoxTransform slotPositioning = behaviour.slotPositioning;
BlockState blockState = te.getBlockState();
if (slotPositioning instanceof ValueBoxTransform.Sided) {
ValueBoxTransform.Sided sided = (ValueBoxTransform.Sided) slotPositioning;
Direction side = sided.getSide();
for (Direction d : Iterate.directions) {
ItemStack filter = behaviour.getFilter(d);
if (filter.isEmpty())
continue;
sided.fromSide(d);
if (!slotPositioning.shouldRender(blockState))
continue;
ms.pushPose();
slotPositioning.transform(blockState, ms);
ValueBoxRenderer.renderItemIntoValueBox(filter, ms, buffer, light, overlay);
ms.popPose();
}
sided.fromSide(side);
return;
} else if (slotPositioning.shouldRender(blockState)) {
ms.pushPose();
slotPositioning.transform(blockState, ms);
ValueBoxRenderer.renderItemIntoValueBox(behaviour.getFilter(), ms, buffer, light, overlay);
ms.popPose();
}
}
use of com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform in project Create by Creators-of-Create.
the class LinkRenderer method renderOnTileEntity.
public static void renderOnTileEntity(SmartTileEntity te, float partialTicks, PoseStack ms, MultiBufferSource buffer, int light, int overlay) {
if (te == null || te.isRemoved())
return;
Entity cameraEntity = Minecraft.getInstance().cameraEntity;
float max = AllConfigs.CLIENT.filterItemRenderDistance.getF();
if (!te.isVirtual() && cameraEntity != null && cameraEntity.position().distanceToSqr(VecHelper.getCenterOf(te.getBlockPos())) > (max * max))
return;
LinkBehaviour behaviour = te.getBehaviour(LinkBehaviour.TYPE);
if (behaviour == null)
return;
for (boolean first : Iterate.trueAndFalse) {
ValueBoxTransform transform = first ? behaviour.firstSlot : behaviour.secondSlot;
ItemStack stack = first ? behaviour.frequencyFirst.getStack() : behaviour.frequencyLast.getStack();
ms.pushPose();
transform.transform(te.getBlockState(), ms);
ValueBoxRenderer.renderItemIntoValueBox(stack, ms, buffer, light, overlay);
ms.popPose();
}
}
Aggregations