Exemplo n.º 1
0
        public override bool ShouldExecute()
        {
            if (cooldownUntilMs > entity.World.ElapsedMilliseconds || failureTime > entity.World.ElapsedMilliseconds)
            {
                return(false);
            }
            prog = entity.GetBehavior <EntityBehaviorProgram>();
            if (prog == null || prog.dormant)
            {
                return(false);
            }
            if (!(entity.LeftHandItemSlot?.Itemstack?.Collectible is ItemHoneyComb) || prog.CheckBarrel() != true)
            {
                return(false);
            }
            Block check = world.BlockAccessor.GetBlock(prog.workBarrel);

            if (check != null && check.Code.Path.Contains("translocatorbarrel"))
            {
                if (!prog.PutInBarrel(new DummySlot(new ItemStack(world.GetItem(new AssetLocation("game:honeyportion")), 1))))
                {
                    failureTime = entity.World.ElapsedMilliseconds + TemporalHackerConfig.Loaded.BotFailureCooldownMs;
                }
                else
                {
                    entity.World.SpawnItemEntity(new ItemStack(world.GetItem(new AssetLocation("beeswax"))), entity.SidedPos.XYZ);
                    entity.LeftHandItemSlot.TakeOut(1);
                    prog.ConsumeEnergy(12);
                }
                return(false);
            }

            targetPos = prog.workBarrel.ToVec3d();


            return(targetPos != null);
        }
Exemplo n.º 2
0
        public override bool ShouldExecute()
        {
            if (cooldownUntilMs > entity.World.ElapsedMilliseconds || failureTime > entity.World.ElapsedMilliseconds)
            {
                return(false);
            }
            prog = entity.GetBehavior <EntityBehaviorProgram>();
            if (prog == null || prog.dormant)
            {
                return(false);
            }
            if (!(entity.LeftHandItemSlot?.Itemstack?.Collectible.MatterState == EnumMatterState.Liquid) || prog.CheckBarrel() != true)
            {
                return(false);
            }
            Block check = world.BlockAccessor.GetBlock(prog.workBarrel);

            if (check != null && check.Code.Path.Contains("translocatorbarrel"))
            {
                if (!prog.PutInBarrel(entity.LeftHandItemSlot))
                {
                    failureTime = entity.World.ElapsedMilliseconds + TemporalHackerConfig.Loaded.BotFailureCooldownMs;
                }
                else
                {
                    prog.ConsumeEnergy(3);
                }
                return(false);
            }

            targetPos = prog.workBarrel.ToVec3d();


            return(targetPos != null);
        }