Search in sources :

Example 1 with TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour in project createaddition by mrh0.

the class TeslaCoilTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    processingBehaviour = new BeltProcessingBehaviour(this).whenItemEnters((s, i) -> TeslaCoilBeltCallbacks.onItemReceived(s, i, this)).whileItemHeld((s, i) -> TeslaCoilBeltCallbacks.whenItemHeld(s, i, this));
    behaviours.add(processingBehaviour);
}
Also used : LivingEntity(net.minecraft.world.entity.LivingEntity) AABB(net.minecraft.world.phys.AABB) Config(com.mrh0.createaddition.config.Config) Direction(net.minecraft.core.Direction) BlockState(net.minecraft.world.level.block.state.BlockState) AllItems(com.simibubi.create.AllItems) ArrayList(java.util.ArrayList) CAItems(com.mrh0.createaddition.index.CAItems) ProcessingResult(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult) DamageSource(net.minecraft.world.damagesource.DamageSource) TransportedResult(com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult) CABlocks(com.mrh0.createaddition.index.CABlocks) CapabilityEnergy(net.minecraftforge.energy.CapabilityEnergy) TransportedItemStackHandlerBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour) CreateAddition(com.mrh0.createaddition.CreateAddition) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) MobEffectInstance(net.minecraft.world.effect.MobEffectInstance) BeltProcessingBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour) Player(net.minecraft.world.entity.player.Player) List(java.util.List) BaseElectricTileEntity(com.mrh0.createaddition.energy.BaseElectricTileEntity) IHaveGoggleInformation(com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation) BlockPos(net.minecraft.core.BlockPos) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) TransportedItemStack(com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack) ItemStack(net.minecraft.world.item.ItemStack) IEnergyStorage(net.minecraftforge.energy.IEnergyStorage) AE2(com.mrh0.createaddition.compat.applied_energistics.AE2) ChargingChromaticCompound(com.mrh0.createaddition.item.ChargingChromaticCompound) CAEffects(com.mrh0.createaddition.index.CAEffects) BeltProcessingBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour)

Example 2 with TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour 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)

Example 3 with TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour 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 TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour in project Create by Creators-of-Create.

the class DeployerTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    filtering = new FilteringBehaviour(this, new DeployerFilterSlot());
    behaviours.add(filtering);
    processingBehaviour = new BeltProcessingBehaviour(this).whenItemEnters((s, i) -> BeltDeployerCallbacks.onItemReceived(s, i, this)).whileItemHeld((s, i) -> BeltDeployerCallbacks.whenItemHeld(s, i, this));
    behaviours.add(processingBehaviour);
}
Also used : VecHelper(com.simibubi.create.foundation.utility.VecHelper) AABB(net.minecraft.world.phys.AABB) Direction(net.minecraft.core.Direction) Inventory(net.minecraft.world.entity.player.Inventory) Dist(net.minecraftforge.api.distmarker.Dist) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) TooltipHelper(com.simibubi.create.foundation.item.TooltipHelper) TransportedItemStackHandlerBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour) FACING(com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING) BlockHitResult(net.minecraft.world.phys.BlockHitResult) BlockEntity(net.minecraft.world.level.block.entity.BlockEntity) Capability(net.minecraftforge.common.capabilities.Capability) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) BlockPos(net.minecraft.core.BlockPos) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) PartialModel(com.jozufozu.flywheel.core.PartialModel) ItemStack(net.minecraft.world.item.ItemStack) RecipeWrapper(net.minecraftforge.items.wrapper.RecipeWrapper) Tag(net.minecraft.nbt.Tag) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) KineticTileEntity(com.simibubi.create.content.contraptions.base.KineticTileEntity) BlockState(net.minecraft.world.level.block.state.BlockState) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) ServerLevel(net.minecraft.server.level.ServerLevel) ArrayList(java.util.ArrayList) LazyOptional(net.minecraftforge.common.util.LazyOptional) ServerPlayer(net.minecraft.server.level.ServerPlayer) Container(net.minecraft.world.Container) ClipContext(net.minecraft.world.level.ClipContext) AllRecipeTypes(com.simibubi.create.AllRecipeTypes) SequencedAssemblyRecipe(com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipe) AllBlocks(com.simibubi.create.AllBlocks) Nullable(javax.annotation.Nullable) SandPaperItem(com.simibubi.create.content.curiosities.tools.SandPaperItem) AllBlockPartials(com.simibubi.create.AllBlockPartials) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) Component(net.minecraft.network.chat.Component) SandPaperInv(com.simibubi.create.content.curiosities.tools.SandPaperPolishingRecipe.SandPaperInv) AllTriggers(com.simibubi.create.foundation.advancement.AllTriggers) BeltProcessingBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour) Fluid(net.minecraft.world.level.ClipContext.Fluid) Block(net.minecraft.world.level.ClipContext.Block) MinecraftForge(net.minecraftforge.common.MinecraftForge) Recipe(net.minecraft.world.item.crafting.Recipe) Vec3(net.minecraft.world.phys.Vec3) NBTHelper(com.simibubi.create.foundation.utility.NBTHelper) InteractionHand(net.minecraft.world.InteractionHand) Mth(net.minecraft.util.Mth) LerpedFloat(com.simibubi.create.foundation.utility.animation.LerpedFloat) ListTag(net.minecraft.nbt.ListTag) FilteringBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour) BeltProcessingBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour)

Example 5 with TileEntityBehaviour

use of com.simibubi.create.foundation.tileEntity.TileEntityBehaviour in project Create by Creators-of-Create.

the class MechanicalPressTileEntity method addBehaviours.

@Override
public void addBehaviours(List<TileEntityBehaviour> behaviours) {
    super.addBehaviours(behaviours);
    processingBehaviour = new BeltProcessingBehaviour(this).whenItemEnters((s, i) -> BeltPressingCallbacks.onItemReceived(s, i, this)).whileItemHeld((s, i) -> BeltPressingCallbacks.whenItemHeld(s, i, this));
    behaviours.add(processingBehaviour);
}
Also used : ResourceLocation(net.minecraft.resources.ResourceLocation) VecHelper(com.simibubi.create.foundation.utility.VecHelper) Tag(net.minecraft.nbt.Tag) AABB(net.minecraft.world.phys.AABB) InWorldProcessing(com.simibubi.create.content.contraptions.processing.InWorldProcessing) BasinTileEntity(com.simibubi.create.content.contraptions.processing.BasinTileEntity) BlockState(net.minecraft.world.level.block.state.BlockState) ITriggerable(com.simibubi.create.foundation.advancement.ITriggerable) ItemParticleOption(net.minecraft.core.particles.ItemParticleOption) ArrayList(java.util.ArrayList) Ingredient(net.minecraft.world.item.crafting.Ingredient) Container(net.minecraft.world.Container) ItemHandlerHelper(net.minecraftforge.items.ItemHandlerHelper) MechanicalCraftingRecipe(com.simibubi.create.content.contraptions.components.crafter.MechanicalCraftingRecipe) SmartInventory(com.simibubi.create.foundation.item.SmartInventory) Create(com.simibubi.create.Create) AllRecipeTypes(com.simibubi.create.AllRecipeTypes) AllConfigs(com.simibubi.create.foundation.config.AllConfigs) NonNullList(net.minecraft.core.NonNullList) SequencedAssemblyRecipe(com.simibubi.create.content.contraptions.itemAssembly.SequencedAssemblyRecipe) AllBlocks(com.simibubi.create.AllBlocks) BasinOperatingTileEntity(com.simibubi.create.content.contraptions.processing.BasinOperatingTileEntity) TransportedItemStackHandlerBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour) ImmutableSet(com.google.common.collect.ImmutableSet) ItemHelper(com.simibubi.create.foundation.item.ItemHelper) TileEntityBehaviour(com.simibubi.create.foundation.tileEntity.TileEntityBehaviour) CraftingRecipe(net.minecraft.world.item.crafting.CraftingRecipe) RecipeSerializer(net.minecraft.world.item.crafting.RecipeSerializer) AllTriggers(com.simibubi.create.foundation.advancement.AllTriggers) Set(java.util.Set) BeltProcessingBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour) SoundType(net.minecraft.world.level.block.SoundType) List(java.util.List) CompoundTag(net.minecraft.nbt.CompoundTag) Entity(net.minecraft.world.entity.Entity) BlockPos(net.minecraft.core.BlockPos) ItemEntity(net.minecraft.world.entity.item.ItemEntity) Recipe(net.minecraft.world.item.crafting.Recipe) BlockEntityType(net.minecraft.world.level.block.entity.BlockEntityType) Vec3(net.minecraft.world.phys.Vec3) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) Optional(java.util.Optional) NBTHelper(com.simibubi.create.foundation.utility.NBTHelper) ItemStack(net.minecraft.world.item.ItemStack) RecipeWrapper(net.minecraftforge.items.wrapper.RecipeWrapper) ParticleTypes(net.minecraft.core.particles.ParticleTypes) Mth(net.minecraft.util.Mth) AllSoundEvents(com.simibubi.create.AllSoundEvents) BeltProcessingBehaviour(com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour)

Aggregations

TileEntityBehaviour (com.simibubi.create.foundation.tileEntity.TileEntityBehaviour)8 List (java.util.List)8 BlockPos (net.minecraft.core.BlockPos)8 BlockEntityType (net.minecraft.world.level.block.entity.BlockEntityType)8 BlockState (net.minecraft.world.level.block.state.BlockState)8 ItemStack (net.minecraft.world.item.ItemStack)7 AllBlocks (com.simibubi.create.AllBlocks)6 ArrayList (java.util.ArrayList)6 Direction (net.minecraft.core.Direction)6 CompoundTag (net.minecraft.nbt.CompoundTag)6 Vec3 (net.minecraft.world.phys.Vec3)6 AABB (net.minecraft.world.phys.AABB)5 NBTHelper (com.simibubi.create.foundation.utility.NBTHelper)4 Tag (net.minecraft.nbt.Tag)4 ItemEntity (net.minecraft.world.entity.item.ItemEntity)4 AllConfigs (com.simibubi.create.foundation.config.AllConfigs)3 SmartTileEntity (com.simibubi.create.foundation.tileEntity.SmartTileEntity)3 FilteringBehaviour (com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour)3 VecHelper (com.simibubi.create.foundation.utility.VecHelper)3 Mth (net.minecraft.util.Mth)3